Re: Audio devices not updating
Re: Audio devices not updating
- Subject: Re: Audio devices not updating
- From: Jeff Moore <email@hidden>
- Date: Mon, 15 Mar 2010 14:31:45 -0700
On Mar 15, 2010, at 1:25 PM, Ethan Funk wrote:
> How about AudioObjectAddPropertyListener?
Yes and no. The thread context a listener is invoked in has more to do with the specific property being listened to than anything else.
> I am still having problems getting called back in my code. Does this also try to attach to the main thread run loop?
Yes.
> What if I am not running a runloop - a command line application or daemon for example?
A command line tool or daemon that doesn't task it's main thread's run loop has two options. It can either be modified such that the tool/daemon does task the main thread's run loop. Or the tool/daemon can set kAudioHardwareRunLoop to tell the HAL what thread it should use.
Note that you have to do one or the other to have a functional HAL in your process.
> Ethan...
>
> On Mar 15, 2010, at 11:30 AM, Jeff Moore wrote:
>
>> A couple of things come to mind.
>>
>> The default device is a setting that is tracked on a per-user basis. It doesn't sound like this is something is tripping you up currently, but it is something to keep in mind when writing a program that monitors the settings used by other programs.
>>
>> The most likely cause of your problem is that your process's main run loop is not getting time to run. Note that by default, the HAL will attach all it's notifications and what not to the main thread's run loop. If this run loop never gets a chance to run, the HAL will never know about things going on in the rest of the system.
>>
>> There are two solutions. You can either modify your program such that the main thread's run loop gets time to run. Or you can tell the HAL to use another thread for notifications using the system object property, kAudioHardwareRunLoop. Note that if you set the value of kAudioHardwareRunLoop to NULL, the HAL will create and manage it's own thread for notifications.
>>
>> --
>>
>> Jeff Moore
>> Core Audio
>> Apple
>>
>>
>> On Mar 15, 2010, at 10:48 AM, Andrew Hughes wrote:
>>
>>> I'm writing what I hoped would be a simple program that puts a menu in the status bar that allows me to quickly set the default system output device. However, the list of available output devices is not updating. I am developing on a new iMac and switching between the computer's speakers and a Digi 003 rack.
>>>
>>> An example scenario: I run the program and the list of available interfaces is correct (Built-in Output and Digi 003 Rack). Then I turn off the 003 and I nether receive an callback to update the list of available devices nor does the list update properly when I trigger a refresh manually; ie, both devices are still listed. However, if I quit the program and restart, the device list updates.
>>>
>>> At first I thought this was a problem with my code, but then I downloaded Apple's "AudioDeviceNotify" example program and it has the same behavior. The only way to get the device list to update is to re-start the program. Simply triggering a call to updateDeviceList returns the same list of devices that shows the 003 even though it is turned off.
>>>
>>> Does anybody have any ideas on why this is happening?
>
--
Jeff Moore
Core Audio
Apple
_______________________________________________
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