Game Development Reference
In-Depth Information
Pro Tip: Latency
One thing that bears mentioning is
that, at the present time, noticeable
delays when triggering sound in
Android are just a fact of life. Getting
true low-latency audio in an Android
game is pretty challenging. You have
to deal with software and hardware
specii cations that can vary widely. This
means that responsive audio that reacts
to user input (like pressing a button, for
example) can suf er from timing issues
that are undesirable (this is especially
true when having to decompress
audio on the l y). This has led in some
cases, to developers having to choose
between triggering music or sound in
their applications. Currently, there's
not one magic bullet that will solve all
these issues, but many engineers and
experts are working to close the gap.
This diagram shows the use of Android hardware for game audio. Applications will use the
MediaPlayer side of the structure usually. Any 3D positional ef ects or audio will be handled
by a custom limited version of OpenSL ES. All audio data must then be mixed and decoded
into PCM streams as an AudioTrack. The AudioFlinger is an audio server framework that
then takes the audio data and routes it to the hardware via dif erent kernel sound drivers
(chiel y ALSA).
Most hardware running Android supports the playback of the following
i le types:
• AAC (.aac, .Mp4a)
MP3 (.mp3)
Ogg Vorbis (.ogg)
FLAC (.l ac)
WAV (.wav)
MIDI (.mid)
The inclusion of Ogg Vorbis in this list is signii cant. In addition to being
entirely open sourced in terms of hardware and software (meaning it
can run in an operating system or be encoded in a hardware chip), Ogg
Vorbis is an increasingly common format for game audio. Interestingly
FLAC is also included. This is a data-compression format that does not
change the original audio data; it merely i ts the data into the smallest
space possible, usually achieving 2:1 compression. AIFF support does not
seem to be natively included. Playback on Android is roughly similar to
iOS—1 hardware mono or stereo PCM channel, and numerous software
streams controlled by a mixer API. MIDI playback is made possible in
Android through the embedded SONiVox Jet system.
 
Search WWH ::




Custom Search