Message: 11
Date: Mon, 16 Nov 2009 17:21:45 -0800
From: Jeff Moore <
email@hidden>
Subject: Re: Aggregate question device
To: CoreAudio API <
email@hidden>
Message-ID: <
email@hidden">
email@hidden>
Content-Type: text/plain; charset=iso-8859-1
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);
}
}