AndroidAudio, AndroidSound, and AndroidMusic: Crash, Bang, Boom!

In Chapter 3, we designed three interfaces for all our audio needs: audio, sound, and music. Audio is responsible for creating sound and music instances from asset files. Sound lets us playback sound effects that are stored in RAM, and music streams bigger music files from the disk to the audio card. In Chapter 4, you learned which Android APIs are needed to implement this. We will start with the implementation of AndroidAudio, as shown in Listing 5–2.

Listing 5–2. AndroidAudio.java; Implementing the Audio Interface

package com.badlogic.androidgames.framework.impl; import java.io.IOException; import android.app.Activity; import android.content.res.AssetFileDescriptor; import ...

Get Beginning Android 4 Games Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.