Game Development Reference
In-Depth Information
Getting ready
Download the source code of the Martins Mozeiko port from his page: http://pielot.
org/2010/12/14/openal-on-android/ .
The home page of the library is as follows: http://github.com/AerialX/openal-soft-
android .
How to do it...
1.
To render the generated, or saved, audio stream we use the OpenAL library, which is
compiled using the standard Android.mk and Application.mk coniguration iles
included in the accompanying materials.
2.
The Android port of the library is actually a wrapper made by Martins Mozeiko for
the Android Java class android.media.AudioTrack using the JNI. The code is
licensed under the GNU Library General Public License and is included in the topic's
supplementary materials.
How it works…
The minimalistic source code to initialize and deinitialize OpenAL looks as follows:
ALCdevice* Device = alcOpenDevice( NULL );
ALCcontext* Context = alcCreateContext( Device, NULL );
alcMakeContextCurrent( Context );
alcDestroyContext( Context );
alcCloseDevice( Device );
See also
F Chapter 5 , Cross-platform Audio Streaming
Compiling libvorbis, libmodplug, and
libtheora
For the loading of audio streams, we use libogg, libvorbis, and libmodplug. Video streams
are handled in a similar way with the libtheora library. Here, we only give general hints on how
to build the libraries from their sources, since the actual build process is straightforward once
you have our typical Android.mk and Application.mk iles in place.
 
Search WWH ::




Custom Search