Can Audio Unit Extensions be hosted using AU v2 API?

Can the new iOS 9 Audio Unit Extensions be hosted using the AU v2 API? Or is the v3 API mandatory?

We have v2 AU host code already. Starting from scratch with v3 would be much more work.

Answered by theanalogkid in 29734022

There are bridges between both versions to make life as easy as possible for hosts. v3 hosts can use v2 AUs while v2 hosts are required to make some minor API changes to be able to host v3 audio units.


This information is discussed at about the 20min point in the WWDC Session < https://developer.apple.com/videos/wwdc/2015/?id=508 >.


The summary comes down to the v2 host checking for a new flag kAudioComponentFlag_RequiresAsyncInstantiation and then using the new AudioComponentInstantiate insted of AudioComponentInstanceNew. There is also a new property from retrieving the v3 units view dependent on the flag kAudioComponentFlag_IsV3AudioUnit.


The above "Audio Unit Extensions" presentation also has an accompanying v3 extension and host example for download.

Accepted Answer

There are bridges between both versions to make life as easy as possible for hosts. v3 hosts can use v2 AUs while v2 hosts are required to make some minor API changes to be able to host v3 audio units.


This information is discussed at about the 20min point in the WWDC Session < https://developer.apple.com/videos/wwdc/2015/?id=508 >.


The summary comes down to the v2 host checking for a new flag kAudioComponentFlag_RequiresAsyncInstantiation and then using the new AudioComponentInstantiate insted of AudioComponentInstanceNew. There is also a new property from retrieving the v3 units view dependent on the flag kAudioComponentFlag_IsV3AudioUnit.


The above "Audio Unit Extensions" presentation also has an accompanying v3 extension and host example for download.

Thanks for your answer! I wasn't sure V2 <--> V3 bridging was OS X-only or not.

AudioToolbox/AudioUnitUtilities.h doesn't seem to be available for iOS, so I'm not sure if hosting audio units using the v2 API is really possible.


How are we supposed to notify the GUI after restoring the settings using kAudioUnitProperty_ClassInfo? AudioUnitProperties.h says we should call AUParameterListenerNotify, but that's not available for iOS.


Supporting full parameter automation requires quite a lot of features provided by AudioUnitUtilities.h.

Hmmm, well iOS 8 provides a number of AUs from Apple that you can host today (and have been able to host for years) no views of course. According to my understanding of the bridging mechanism, I take it to mean that if you update to the new instantiation API you will be able to use the v3 AUs along with the older v2 AUs and you will not require 2 different APIs to do this.

So, existing iOS hosts that use AudioComponentInstanceNew will need a minor change having to do with async. instantiation in that if the type of AUAudioUnit has the kAudioComponentFlag_RequiresAsyncInstantiation flag set, you must use the new AudioComponentInstantiate (required for v3 audio units with views).

Doug explains this starting at 19:45 into the presentation. I think it was clear from the outset of the presentation when it was mentioned that v2 hosts are required to make some minor API changes to be able to host v3 audio units.

I'll take this feedback to Core Audio engineering and in future presentations of this type of material we can try harder to be super clear regarding what we're trying to explain. After all, we don't really want to cause more confusion right.

Also, please file a bug for v3 Audio Unit documentation. This type of topic really needs to be convered in a "Audio Unit Hosting Guide" of some sort and we really need one that's current. Thanks!

Can Audio Unit Extensions be hosted using AU v2 API?
 
 
Q