Chapter 6. Making a Racket: Audio Toolbox and AVFoundation

The AVFoundation framework was introduced in version 2.2 of the iPhone SDK, and provides functionality for playing and mixing sound files, metering, and basic audio control. If you're adding simple sounds to your application, this framework can be implemented quickly and painlessly.

The Audio Toolbox framework is responsible for managing digital sound output on the iPhone. Unlike many of the frameworks covered in this book so far, the Audio Toolbox framework is predominantly C-oriented. This powerful framework allows you to generate and record digital sound. In addition to the examples provided in this chapter, many references have been written for Audio Toolbox, which are available on the Apple Developer Connection website. These include the following:

Core Audio Overview: AudioToolbox.framework

Audio Toolbox Framework Reference

Audio File Services Reference

Audio File Stream Services Reference

Audio Queue Services Reference

Because it exists on the desktop platform, the Audio Toolbox framework is documented fairly well. We won't cover it in its entirety hereā€”just the pieces relevant to the iPhone SDK. Many pieces of the framework, such as MIDI controllers and Music Player APIs, aren't relevant or available on the iPhone.

In order to use the Audio Toolbox framework, you'll need to add it as a framework to your existing project. Right-click on the Frameworks folder in your Xcode project, and choose Addrightwards double arrowExisting Frameworks. Navigate to the iPhone SDK's Frameworks directory and choose the AudioToolbox.framework folder.