Re: Bug in AudioHardwareServiceRemovePropertyListener? It doesn't seem to have any effect (sample code as separate download)
Re: Bug in AudioHardwareServiceRemovePropertyListener? It doesn't seem to have any effect (sample code as separate download)
- Subject: Re: Bug in AudioHardwareServiceRemovePropertyListener? It doesn't seem to have any effect (sample code as separate download)
- From: Jeff Moore <email@hidden>
- Date: Mon, 06 Sep 2010 13:26:25 -0700
This sounds like a bug. Please file it in BugReporter so we can take a look.
Thanks!
--
Jeff Moore
Core Audio
Apple
On Sep 6, 2010, at 2:32 AM, Felix Schwarz wrote:
> I try to use property listeners in my application running under OS X 10.6.4. This is what I do:
>
> 1) I first define a volume change property address (globally so it always has the same address - just to be sure):
>
> static const AudioObjectPropertyAddress sVolumePropertyListener = { kAudioHardwareServiceDeviceProperty_VirtualMasterVolume, kAudioDevicePropertyScopeOutput, kAudioObjectPropertyElementMaster };
>
> 2) I define a callback
>
> static OSStatus MyPropertyListener( AudioObjectID inObjectID,
> UInt32 inNumberAddresses,
> const AudioObjectPropertyAddress inAddresses[],
> void *inClientData)
> {
> NSLog(@"Volume changed - object: %@", (id)inClientData);
> return (0); // Should always return zero
> }
>
>
> 3) I then add a property listener proc (with retValue being noErr upon return) via
>
> retValue = AudioHardwareServiceAddPropertyListener(audioDeviceID, &sVolumePropertyListener, MyPropertyListener, self);
>
> 4) Subsequently I remove it (with retValue being noErr upon return) via
>
> retValue = AudioHardwareServiceRemovePropertyListener(audioDeviceID, &sVolumePropertyListener, MyPropertyListener, self);
>
> 5) If I now change the volume of the device, my MyPropertyListener callback is still called. Since I passed an Obj-C object as clientData and use it inside the callback, my application crashes since that object no longer exists.
>
> I've written a tiny sample app showing the issue (it logs everything to the Console via NSLog). You can download the Xcode project at
> http://www.wapapp.de/AudioToolboxPropertyListenerIssue.zip
>
> Q: Is there anything I missed - or is AudioHardwareServiceRemovePropertyListener currently not working?
>
> Thanks in advance for any insight you can provide!
_______________________________________________
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