Re: Default device notifications
Re: Default device notifications
- Subject: Re: Default device notifications
- From: "John Haggerty" <email@hidden>
- Date: Mon, 31 Jul 2006 11:09:49 -0700
OK, that explains things. It turns out that for various abstruse
reasons, it is difficult to listen on the main thread in my application
(it is busy doing other things). Is there any way to tell
CFDistributedNotificationCenter that another thread is interested? And
I haven't been able to find much in the way of documentation for
CFDistributedNotificationCenter. Do you have a convenient link?
Thanks,
John
On 7/28/06, Jeff Moore <email@hidden> wrote:
AMS == /Applications/Utilities/Audio MIDI Setup.app
At any rate, I just tested what you described and I saw every app on
the system notice the change in default device when I went from "line
in" to my USB mic in the Sound Prefs. HALLab (which is one of the
apps in our SDK) happily displayed the notification when it came in.
Default device notifications happen on the process's main thread as
they are transported around the system using a
CFDistributedNotificationCenter. This is different from device died
notifications, which happen on the HAL's notification thread. Perhaps
you are not tasking the main thread's run loop (hard to do in a Cocoa
app, but easy to do pretty much everywhere else)? This would
effectively prevent the HAL from receiving the notification from the
other process and so the HAL wouldn't be able to tell you.
On Jul 28, 2006, at 3:51 PM, John Haggerty wrote:
> Actually, I am trying to change between Line in and a USB mic. No
> notifications if I change the device in System Preferences, but I
> do get a notification if the default device is the USB mic and I
> remove it. And at the risk of appearing a complete gumby, what is AMS?
>
> On 7/28/06, Jeff Moore <
email@hidden> wrote: Let me guess, you
> are switching from "line in" to "built-in mic" or
> something like that?
>
> The Sound Prefs panel has an expanded view of what a device is when
> it comes to the built-in hardware. Instead of just listing the built-
> in hardware as one device, it lists each entry in the built-in
> hardware's data source selector control as if it was a device. You
> can see the differences if you compare the device list displayed in
> AMS with the Sound Prefs.
>
> Whenever you select one of these "devices" you are in reality not
> changing the default device, but rather changing the value of it's
> data source selector control. So if you want notifications about
> this, you need to pay attention to those notifications. Note however,
> that this is complicated by the fact that not every device has a
> source selector (including the built-in hadware on the various models
> of Macs we have put out over the years) and that you'd only want to
> listen to it when it's owning device is already selected as the
> default device.
>
> On Jul 28, 2006, at 3:09 PM, John Haggerty wrote:
>
> > I am trying to set things up so that I get notifications when the
> > default device is changed, for example via System Preferences.
> >
> > I am adding a callback thusly:
> > AudioHardwareAddPropertyListener
> > (kAudioHardwarePropertyDefaultInputDevice,...)
> >
> > This works if the actual hardware changes (
e.g. if the default
> > input device is a USB mic and I remove it) but not if I change the
> > default device in System Preferences. Do I have to register another
> > callback for this?
>
>
> --
>
> Jeff Moore
> Core Audio
> Apple
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
>
--
Jeff Moore
Core Audio
Apple
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (
This email sent to email@hidden
_______________________________________________
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