• 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
Property listener not working in 10.7
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Property listener not working in 10.7


  • Subject: Property listener not working in 10.7
  • From: Bill Preder <email@hidden>
  • Date: Mon, 06 Feb 2012 16:19:35 -0800

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

  • Follow-Ups:
    • Re: Property listener not working in 10.7
      • From: Dave Fernandes <email@hidden>
  • Prev by Date: Re: How to enable iphone call recording?
  • Next by Date: Re: Property listener not working in 10.7
  • Previous by thread: Re: How to enable iphone call recording?
  • Next by thread: Re: Property listener not working in 10.7
  • Index(es):
    • Date
    • Thread