Core Audio Conventions
The Core Audio frameworks are exposed as C function calls. This makes them broadly available to Cocoa, Cocoa Touch, and Carbon apps, but you have to be ready to deal with all the usual issues of procedural C, such as pointers, manual memory management, structs, and enums. Most modern developers have cut their teeth on object-oriented languages such as Objective-C, C++, and Python, so it’s no longer a given that professional programmers are comfortable with procedural C.
In C, you don’t have classes, object orientation, implementation hiding, or many of the other important language traits that most developers have depended on for years. But Core Audio, like Apple’s other C-based frameworks, does provide a measure of these modern traits, even within the C idiom.
Apple’s model C framework is Core Foundation, which underlies Foundation, the essential Objective-C framework that nearly all Mac and iPhone applications use. You’ll recognize Foundation by classes such as NSString, NSURL, NSDate, and NSObject. In many cases, the Objective-C classes assemble their functionality by calling Core Foundation, which provides opaque types (pointers to data structures whose actual members are hidden) and functions that work on these objects. For example, an NSString is literally the same as a CFStringRef (you can freely cast between the two), and its length method is equivalent to the function CFStringGetLength(), which takes a CFStringRef as its object. By combining these opaque types with consistent naming conventions for functions, Core Foundation provides a highly manageable C API with a clarity similar to what you’re used to in Cocoa.
Core Audio is highly similar in its design. Many of its most important objects (such as audio queues and audio files) are treated as opaque objects that you hand to predictably named functions, such as AudioQueueStart() or AudioFileOpenURL(). It’s not explicitly built atop Core Foundation—an AudioQueueRef is not technically a CF opaque type; however, it does make use of CF’s most important objects, such as CFStringRef and CFURLRef, which can be trivially cast to and from NSStrings and NSURLs in your Cocoa code.