ObjectAL in a Nutshell
OVERVIEW
ObjectAL for iPhone and Mac is designed to be a simpler, more intuitive interface to OpenAL and AVAudioPlayer. There are four main parts to ObjectAL:
- ObjectAL gives you full access to the OpenAL system without the hassle of the C API. All OpenAL operations can be performed using first class objects and properties, without needing to muddle around with arrays of data, maintain IDs, or pass around pointers to basic types.
- OALAudioTrack provides a simpler interface to AVAudioPlayer, allowing you to play, stop, pause, fade, and mute background music tracks.
- OALAudioSupport provides support functionality for audio in iOS devices, including automatic interrupt handling and audio data loading routines. As well, it provides an easy way to configure how the audio session will handle iPod-style music playing and the silent switch.
- OALSimpleAudio layers on top of the other three, providing an even simpler interface for playing background music and sound effects.
OBJECTAL
ObjectAL follows the same basic principles as the OpenAL API:
- ALDevice represents a physical audio
device.
Each device can have one or more contexts (ALContext) created on it, and can have multiple buffers (ALBuffer) associated with it. - ALContext controls the overall sound
environment, such as distance model, doppler effect, and speed of sound.
Each context has one listener (ALListener), and can have multiple sources (ALSource) opened on it (up to a maximum of 32 overall on iPhone). - ALListener represents the listener of sounds originating on its context (one listener per context). It has position, orientation, and velocity.
- ALSource is a sound emitting source that plays sound data from an ALBuffer. It has position, direction, velocity, as well as other properties which determine how the sound is emitted.
- ALBuffer is simply a container for sound data. Only linear PCM is supported directly, but IphoneAudioSupport load methods, and SimpleIphoneAudio effect preload and play methods, will automatically convert any formats that don't require hardware decoding (though conversion results in a longer loading time).
- ALChannelSource allows you to reserve a certain number of sources for special purposes.
- OpenALManager provides some overall controls that affect everything, and manages the current context.