• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Device gone away notification?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Device gone away notification?


  • Subject: Re: Device gone away notification?
  • From: Brian Willoughby <email@hidden>
  • Date: Sun, 6 Sep 2009 20:12:54 -0700


On Sep 6, 2009, at 12:55, Ethan Funk wrote:
I noticed the following behavior in the HAL output unit:

The units device is set to a USB audio device, everything is set up and running with audio playing through the unit, then I pull the USB plug. Suddenly, the audio starts playing through the system sound device.

Are you using the HAL directly, via AudioDeviceAddIOProc(), or one of the AudioUnit Output Units such as kAudioUnitSubType_DefaultOutput, or kAudioUnitSubType_HALOutput? Just wanted to make sure we're on the same page.



OK, that's a nifty trick, but what I really need is some sort of notification so I can stop and tear down the audio unit. Is there such a mechanism? What would be really nice is if the rendering would stop until the device comes back, but that is a lot to ask.

You possibly want AudioDeviceAddPropertyListener() with kAudioDevicePropertyDeviceIsAlive, kAudioDevicePropertyDeviceHasChanged, kAudioDevicePropertyDeviceIsRunning, or kAudioDevicePropertyDeviceIsRunningSomewhere.


If you're using the AudioUnit Output Units instead of accessing the HAL directly, then you would ask the AU for the Device via kAudioOutputUnitProperty_CurrentDevice. If you're setting the unit to a specific USB device elsewhere in your code, then you probably already have the AudioDeviceID somewhere in a local variable. You could also skip the device property listener from the paragraph above and simply call AudioUnitAddPropertyListener() with kAudioOutputUnitProperty_CurrentDevice, kAudioOutputUnitProperty_IsRunning, or perhaps kAudioOutputUnitProperty_EnableIO or kAudioOutputUnitProperty_HasIO.

Brian Willoughby
Sound Consulting

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Device gone away notification?
      • From: Stephen Davis <email@hidden>
References: 
 >Device gone away notification? (From: Ethan Funk <email@hidden>)

  • Prev by Date: Device gone away notification?
  • Next by Date: RE: Building AudioUnits for Mac OS 10.4 on Snow Leopard
  • Previous by thread: Device gone away notification?
  • Next by thread: Re: Device gone away notification?
  • Index(es):
    • Date
    • Thread