Create Aggregate Audio Device Using Core Audio

Hi. I have been looking all over to find a good answer on how to create an aggregate audio device using Core Audio on iOS or OS X. According to the Core Audio documentation, it is possible, but the only tutorial I could find was outdated and written in Objective-C. I woud appreciate a good example of how I would go about doing this, preferably with bluetooth speakers, or even a good explanation of how it works. I would like to note that I have started a thread on Stackoverflow, but I haven't had any luck. I did also remove a few links so that this could be posted. Thanks in advance!

If you look in AudioHardware.h you will find AudioHardwareCreateAggregateDevice(CFDictionaryRef inDescription, AudioObjectID* outDeviceID), which makes it much easier to create an aggregate device - it takes a CFDictionary specifying how to build the aggregate device and returns the device ID. This API was added in OS X 10.9.


Creating the dictionary hasn't changed, so any code you have for that should still work. You will find all the dictionary keys in the same header file listed in the AudioAggregateDevice Constants section as kAudioAggregateDeviceXXXKey's.


If your reference code is making use of deprecated HAL APIs, this TechNote discusses how to move off those - Moving Off Deprecated HAL APIs

I really appreciate that! That helps a lot, but I am a novice developer, so do you mind explaining it in slighlty simpler terms? I can just create an aggregate device object, and use a CFDictionary to set it up, basically? If it's not too much trouble, do you mind providing a bit of sample code.. My last question is whether this will work on iOS like it will on OS X. That would be great to make an aggregate audio device on an iPhone!

The new API removes the need for the code dealing with kAudioHardwarePropertyPlugInForBundleID and so on, which is deprecated. You just need to provide the dictionary describing how to build the device and the API will do it for you. This is the same dictionary code found in online examples. Unfortunatley, I don't currently have anything I can post, but if I have time I'll try and throw something together - maybe someone else in the forum has something they can just cut/paste?


As for iOS, the HAL isn't available in iOS and neither is AudioHardware.h so, yea...no way to do that.

Thanks. I've been looking around, and I have found a few snippets of code using the technique you described. I've messed around with it, but I'll just have to let you know if I get it right. I would like to post some code, just for anyone looking for the same answer!

Create Aggregate Audio Device Using Core Audio
 
 
Q