Post not yet marked as solved
Post marked as unsolved with 0 replies, 490 views
I have created an aggregated device containing multiple audio devices.
I would like to enable/disable input or output channels from an aggregate CoreAudio device.
When calling core audio to receive the number of streams (using kAudioDevicePropertyStreams) the return value is always 1.
I have also tried the implementation in CoreAudio Utility classes: CAHALAudioDevice::GetIOProcStreamUsage.
Still I could not see how to access sub-streams and disable/enable them.
What needs to be done to accomplish disable/enable of sub-streams?
Here is CAHALAudioDevice::GetIOProcStreamUsage for reference:
void
// make an AudioHardwareIOProcStreamUsage the right size
UInt32 theNumberStreams = GetNumberStreams(inIsInput);
UInt32 theSize = SizeOf32(void*) + SizeOf32(UInt32) + (theNumberStreams * SizeOf32(UInt32));
CAAutoFree<AudioHardwareIOProcStreamUsage> theStreamUsage(theSize);
// set it up
theStreamUsage->mIOProc = reinterpret_cast<void*>(inIOProcID);
theStreamUsage->mNumberStreams = theNumberStreams;
// get the property
CAPropertyAddress theAddress(kAudioDevicePropertyIOProcStreamUsage, inIsInput ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput);
GetPropertyData(theAddress, 0, NULL, theSize, theStreamUsage);
// fill out the return value
for(UInt32 theIndex = 0; theIndex < theNumberStreams; ++theIndex)
{
outStreamUsage[theIndex] = (theStreamUsage->mStreamIsOn[theIndex] != 0);
}
}
kAudioDevicePropertyIOProcStreamUsage always returns one stream regardless of the amount of sub devices in the aggregated audio device