I write music applications in C++ for the Mac OSX operating system. There are many advantages to working this way, and one big disadvantage. That disadvantage is that one is obliged to maintain low-level interactions with the operating system and development environment (something that can otherwise be happily left to commercial application vendors). The specific challenges are these:
- Working with Objective-C, Apple’s kludgey smalltalk-tinged C superset that they (and only they) use and foist off on the rest of us. The trick is to get in and out of it, and back to C++, as quickly as possible.
- Working with Core Audio, the OSX API for audio in and out of the operating system. While Apple does many things well (I have never owned another kind of computer), documentation is certainly not one of them.
- Figuring out how to use XCode to make all of this happen. This bit is probably the easiest of the three, but only because so many third party sources are available to explain it.
The application EZOSXOsc under the Code & Applications tab is the first public manifestation of all this: it produces an OSX app that allows you to click a button and turn a sine wave on and off. Not very exciting, certainly, but that’s the point: to produce an example that demonstrates as simply as possible how to compute a sine wave and send it to the speakers.