Re: Property listener not working in 10.7
Re: Property listener not working in 10.7
- Subject: Re: Property listener not working in 10.7
- From: Dave Fernandes <email@hidden>
- Date: Mon, 06 Feb 2012 19:41:34 -0500
I'm able to get listener calls on changes to the physical format, but I have an extra step in my code. After you get the device ID, you then get the input streams for that device, and then add a listener to the input stream (AudioStreamID) - and use global scope.
Dave
On 2012-02-06, at 7:19 PM, Bill Preder wrote:
> Hello,
>
> It seems our property listeners aren't getting called in OS 10.7, whereas they work fine in 10.6. I've tried setting base SDK and deployment targets to 10.7, to no avail.
>
> Our apps need to listen for changes to the stream physical format (for example, when the user changes a device's sample rate in Audio MIDI Setup).
>
> Example code follows. AudioObjectAddPropertyListener() always returns noErr upon adding MyDevicePropertyListenerProc(). However, my callback never gets called when changing the device's SR in AMS. For simplicity's sake, assume the default input device is one of the Built-Ins. Any help is appreciated.
>
> Thanks,
> Bill Preder
> BIAS, Inc.
>
> // dummy listener callback
> OSStatus MyDevicePropertyListenerProc(AudioObjectID inObjectID,
> UInt32 inNumberAddresses,
> const AudioObjectPropertyAddress inAddresses[],
> void * inClientData )
> {
> printf("MyDevicePropertyListenerProc() called\n");
> return noErr;
> }
>
> // code that adds the listener
> OSStatus AddListenerToDefaultInputDevice()
> {
> OSStatus result;
> AudioDeviceID deviceID;
> UInt32 propSize = sizeof(AudioDeviceID);
>
> AudioObjectPropertyAddress propAddr;
> propAddr.mSelector = kAudioHardwarePropertyDefaultInputDevice;
> propAddr.mScope = kAudioDevicePropertyScopeInput;
> propAddr.mElement = kAudioObjectPropertyElementMaster;
>
> // get the default input device's ID
> result = AudioObjectGetPropertyData( kAudioObjectSystemObject, &propAddr, 0, NULL, &propSize, &deviceID );
>
> if (result == noErr)
> {
> // add a property listener for kAudioStreamPropertyPhysicalFormat
> propAddr.mSelector = kAudioStreamPropertyPhysicalFormat;
> result = AudioObjectAddPropertyListener(deviceID, &propAddr, MyDevicePropertyListenerProc, NULL);
> }
> return result;
> }
> _______________________________________________
> 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
_______________________________________________
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