Game Development Reference
In-Depth Information
Caution Not all audio formats are supported by mobile devices. For instance,
OGG and FLAC files cannot be played on iOS. It's best to stick to the most
common formats: .caf and .wav for sound effects, and for long-running audio
use either mp3 or m4a. If you have an audio file in a different format, use an au-
dio converter like SoundConverter or an audio editor like Audacity to convert
the files. And if you have an audio file in the correct format but it won't play, it
may have been created/modified by an audio program that writes nonstandard
extensions or adds metadata that will trip up OpenAL or AVAudioPlayer. In that
case, open the audio file in Audacity, re-export it to the same format, and then
try again.
You'll learn more about OALSimpleAudio 's programming interface shortly in this
chapter. Suffice it to say that ObjectAL covers all of your audio needs. If you need more
functionality than offered by OALSimpleAudio but don't know where to start (besides
the documentation and ObjectAL demos, obviously), I recommend you take a look at how
the OALSimpleAudio class uses the ObjectAL , OALAudioTrack , and OALAudi-
oSession classes.
You can dig deeper into ObjectAL on its homepage at ht-
tp://kstenerud.github.io/ObjectAL-for-iPhone , where you'll find the
documentation and class reference as well as the download archive, which contains addi-
tional demo projects.
Using Audio Files in SpriteBuilder
Although you can add audio files directly to the Xcode project, bypassing SpriteBuilder, it
is recommended that you allow SpriteBuilder to manage all audio files, whether they'll be
used in Timelines or not.
Importing Audio into SpriteBuilder
If you use SpriteBuilder to manage your audio files, you needn't worry too much about
the audio format details. It's best if your input files are uncompressed audio files like
WAV files.
Search WWH ::




Custom Search