Search code examples
swiftavfoundationcore-audioaudiotoolbox

What is the difference between AUAudioUnit and AudioUnit


I saw the WDC 2016 conference about Core Audio and starting at 29min Doug Wyatt talk about real time audio. Since I'm developing an audio app with high performance I need to do that.

However I noticed that he used AUAudioUnit but in my application in C (I prefer to use C/C++ for audio code and I follow the Chris Adamson advices).

So I have 3 questions:

  • What's the difference between AudioUnit and AUAudioUnit? From what I may understand, I read An audio unit is of type AudioComponentInstance as defined in AudioComponent.h and AUAudioUnit would be a wrapper class around it.

  • Why I cannot use AUAudioUnit in a C/C++ project? Is it only a Swift thing?

  • If yes, should I continue to develop my audio unit graph and nodes in C/C++ or should I switch to the Swift class AUAudiounit


Solution

  • 1) I think the best way to describe the difference between AUAudioUnit and AudioUnit is that AUAudioUnit is an Objective-C class and AudioUnit is a set of (C/C++) API's which together act as the AudioUnit framework. (BTW AudioUnit is now part of the AudioToolbox framework)

    2) AUAudioUnit is an Objective-C class. I don't know if it's possible to link to objc from C/C++ but if so, that'll not very easy to do. And depending on your underlying problem probably not even the best thing to do.

    3) It really depends on what you intent to do with your application. There are a lot of C/C++ API's in the CoreAudio & AudioToolBox framework including AudioComponent.h. So if that's what you're looking for you can perfectly use that directly in you C/C++ application.

    I will be really helpful to look at the CoreAudio & AudioToolbox headers directly. There's a lot of useful information in there.