Game Development Reference
In-Depth Information
The preferred audio format for iOS devices is 16-bit, little endian, linear PCM pack-
aged as CAF file (Apple CAF audio format code: LEI16 ), according to Apple's Audio
Coding How To, which contains generally helpful advice for audio programming: ht-
tp://developer.apple.com/library/ios/#codinghowtos/Audi-
oAndVideo/_index.html .
To convert any audio file that afconvert supports to the preferred iOS audio format,
run the afconvert command like this:
afconvert -f caff -d LEI16 myInputFile.mp3 myOutputFile.caf
The -f (or -file ) switch denotes the file format, which is caff for CAF files. With
the -d switch, you specify the audio data format, here LEI16 . You can get a list of the
audio data formats supported by afconvert by running afconvert with the -hf
switch.
Note If you're ever in the situation where an audio file just won't play or
results in a garbled mess of noise, there's probably nothing wrong with your
code or your device. There are countless audio applications and numerous au-
dio codecs, and they all create their own variations of the respective formats.
Some can't play on iOS devices but play fine otherwise. Particularly, WAV files
seem to be affected, which is why I prefer to use Apple's more native audio
container format CAF. Typically, the way you can fix broken audio files is to
open the audio file in an audio-editing program that you know is capable of
saving iOS-compatible audio files and then save it again. You can do this with
the aptly named SoundConverter or the audio application of your choice. Usu-
ally, after this resave, the file will play just fine on the iOS device. Also sound
issues are common in the iOS Simulator. If the issue only occurs in the Simulat-
or, you can ignore it and maybe fix it by rebooting your computer.
iPad Considerations
With all coordinates taking the screen's size into account, the game should simply scale
up without any problems when running it on the iPad's bigger screen. And it does. Just
Search Nedrilad ::




Custom Search