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

Re: Aggregate question device


  • Subject: Re: Aggregate question device
  • From: Jeff Moore <email@hidden>
  • Date: Mon, 16 Nov 2009 17:21:45 -0800

Sigh. What was still wrong was a bug in the HAL (which I also wrote up) where the attributes for all the sub-devices were not getting transferred over as part of the aggregate device's creation.

To work around this bug, you will need to enable drift correction on each sub-device that needs it after you create the aggregate. You do this by getting the sub-devices of the aggregate using the property, kAudioObjectPropertyOwnedObjects. Then you set the property, kAudioSubDevicePropertyDriftCompensation, on each sub-devce as needed.

Here's some code that does just turns on the drift correction for all the sub-devices (again using PublicUtility code to make it look easy):

void	TurnOnDriftCompensation(AudioObjectID inAggregateDeviceID)
{
    //  iterate through the sub-devices and turn on drift compensation
    CAHALAudioDevice theAggregateDevice(inAggregateDeviceID);
    UInt32 theNumberSubDevices = theAggregateDevice.GetNumberOwnedObjects(kAudioSubDeviceClassID);
    CAAutoFree<AudioObjectID> theSubDevices(theNumberSubDevices);
    theAggregateDevice.GetAllOwnedObjects(kAudioSubDeviceClassID, theNumberSubDevices, theSubDevices);
    for(UInt32 theSubDeviceIndex = 0; theSubDeviceIndex < theNumberSubDevices; ++theSubDeviceIndex)
    {
        CAHALAudioObject theSubDevice(theSubDevices[theSubDeviceIndex]);
        CAPropertyAddress theAddress(kAudioSubDevicePropertyDriftCompensation);
        UInt32 theDriftCompensationValue = 1;
        theSubDevice.SetPropertyData(theAddress, 0, NULL, sizeof(UInt32), &theDriftCompensationValue);
    }
}


On Nov 16, 2009, at 3:44 PM, Stéphane Letz wrote:

>> That sub-device dictionary stuff was snipped out of code that builds up an aggregate device description dictionary to be passed to kAudioPlugInCreateAggregateDevice in order to create a new >aggregate device.
>
> OK so I do:
>
> CFMutableArrayRef subDevicesArrayClock = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
>
> CFMutableDictionaryRef subdeviceAggDeviceDict = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
>
> CFDictionaryAddValue(subdeviceAggDeviceDict, CFSTR(kAudioSubDeviceUIDKey), UID); <== with UID of input sub-device
> CFDictionaryAddValue(subdeviceAggDeviceDict, CFSTR(kAudioSubDeviceDriftCompensationKey), AggregateDeviceNumberRef);  <== with AggregateDeviceNumberRef = CFNumberCreate  of 1
> CFArrayAppendValue(subDevicesArrayClock, subdeviceAggDeviceDict);
>
> .. same for output sub-device...
>
> then in previously created aggDeviceDict:
>
> CFDictionaryAddValue(aggDeviceDict, CFSTR(kAudioAggregateDeviceSubDeviceListKey), subDevicesArrayClock);
>
> Then creating a "public" aggregate device works, but I don"t see the resampling checkboxes activated in Audio Midi Setup...
>
> What is still wrong?


--

Jeff Moore
Core Audio
Apple



 _______________________________________________
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: 
 >Re: Aggregate question device (From: Stéphane Letz <email@hidden>)

  • Prev by Date: Re: iPhone - RenderCallback not called when phone is locked
  • Next by Date: Re: iPhone - RenderCallback not called when phone is locked
  • Previous by thread: Re: Aggregate question device
  • Next by thread: Re: Aggregate question device
  • Index(es):
    • Date
    • Thread