• 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: AudioObjectAddPropertyListener
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AudioObjectAddPropertyListener


  • Subject: Re: AudioObjectAddPropertyListener
  • From: Ethan Funk <email@hidden>
  • Date: Fri, 5 Mar 2010 18:02:56 -0700

That's good and bad news... good because it's how I want it to work, and bad because it isn't working in my code.  I built a very simple program that just installed a listener, then fprintfed a message when the callback was triggered.  That worked fine.  Then in my actual, much more complicated and multithreaded application I do the same thing, fprintf's and all, only with multiple calls of the registration with different inClientData values, and the callback never once gets called.  The registration code below  will not necessarily be called in the main thread, but in my testing case, it always it.

register:
AudioObjectPropertyAddress prop;
prop.mSelector = kAudioHardwarePropertyDevices;
prop.mScope = kAudioObjectPropertyScopeGlobal;
prop.mElement = kAudioObjectPropertyElementMaster;
err = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &prop, &audioOutDevListChangedProc, this); 

err is zero when I break on the last line, every time through.

The callback is very simple at the moment:

OSStatus audioOutDevListChangedProc(AudioObjectID inObjectID, UInt32 inNumberAddresses, 
const AudioObjectPropertyAddress inAddresses[], void*inClientData)
{
fprintf(stdout, "Device List changed.\n");
return noErr;
}

Is there something obvious I am missing?  Why no error returned when I register? The same code, with a more complicated and useful callback function, worked fine under OS 10.5/PPC, but not under 10.6/Intel... no compiler warnings (in this area of the code) either.

Thanks,
Ethan...

On Mar 5, 2010, at 3:22 PM, Jeff Moore wrote:

Part of the reason for the creation of AudioObjectAddPropertyListener/AudioObjectRemovePropertyListener was to allow the same function to be registered as a listener multiple times provided that the client data argument is different each time. This obviates the need for things like CATink, for example.

On Mar 5, 2010, at 12:55 PM, Ethan Funk wrote:

If I call AudioObjectAddPropertyListener multiple time with the same inProc values but different inClientData values what happens?  Will by listener proc get called multiple times with each of the various inClientData values passes when the requested listening event occurs, or just once with the last inClientValue passed?

 _______________________________________________
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

References: 
 >AudioObjectAddPropertyListener (From: Ethan Funk <email@hidden>)
 >Re: AudioObjectAddPropertyListener (From: Jeff Moore <email@hidden>)

  • Prev by Date: Re: AudioObjectAddPropertyListener
  • Next by Date: Re: AudioObjectAddPropertyListener
  • Previous by thread: Re: AudioObjectAddPropertyListener
  • Next by thread: Re: AudioObjectAddPropertyListener
  • Index(es):
    • Date
    • Thread