0

I am going to develop an AudioUnit software synth component for use in Logic Pro, GarageBand, etc. In Apple's tutorial, they use C++. Is this mandatory, or could I use Objective C as well?

Richard G. Nielsen
  • 1,221
  • 10
  • 13

2 Answers2

1

I think you cannot avoid C++ completely. According to the documentation, you can create a new AudioUnit by subclassing Core Audio SDK’s C++ superclasses. This is, I think, mandatory.

However, you are free to mix C++ and Objective-C, so you should be able to create the C++ subclass and full-fill the requirements of an AudioUnit interface, but implement (most) of the functionality in Objective C.

piokuc
  • 25,594
  • 11
  • 72
  • 102
  • How does one go from C++ to Objective-C? Will the C++ class need to create an Objective-C object, or can you put Objective-C code in the C++ file? – Richard G. Nielsen Mar 21 '14 at 16:22
  • 1
    You can mix C++ and Objective-C in one source file. There is plenty of materials on the web explaining the details of it, for example: http://philjordan.eu/article/mixing-objective-c-c++-and-objective-c++ – piokuc Mar 21 '14 at 16:33
0

Yet, the central part of audio functionality (the low level rendering callback) consists of procedures, which are mostly written plain C, as you may see in much of the sample code and open source examples. For me it worked best to write this part as stand-alone first, only upon making sure it does its job as desired -robustly and properly, to take care of defining classes, instances, methods and code reusability.

user3078414
  • 1,942
  • 2
  • 16
  • 24