VoltAir
|
Controls the background audio tracks that need gapless playback and looping on Android devices. More...
Public Member Functions | |
void | onStart (Context context) |
Notifies this SoundManager of the onStart activity lifecycle event. More... | |
void | onStop () |
Notifies this SoundManager of the onStop activity lifecycle event. More... | |
void | clearBGMTrack (int priority) |
Clears the audio track of the specified background music priority level. More... | |
boolean | isBGMMuted () |
Returns whether or not the background music is muted. More... | |
void | setBGMTrack (int priority, String track) |
Sets the audio track of the specified background priority level. More... | |
void | setBGMMuted (boolean value) |
Sets whether or not the background music is muted. More... | |
void | setPaused (boolean value) |
Sets SoundManager paused state. More... | |
void | onCompletion (MediaPlayer mp) |
Called when the end of a media source is reached during playback. More... | |
Static Public Attributes | |
static final int | INVALID_PRIORITY = -1 |
Represents an invalid background music priority level and serves as a lower bound on priority. More... | |
Controls the background audio tracks that need gapless playback and looping on Android devices.
This class implements a subset of the API defined in SoundManager.h related to background music. Specifically, it uses double buffering of Android MediaPlayers
to achieve gapless looping.
|
inline |
Clears the audio track of the specified background music priority level.
If priority
was currently the highest priority level with an audio track set, then the background music is transitioned to the next highest priority level for which an audio track is set, or faded out if none are available.
priority | Background music priority level to clear the audio track for |
|
inline |
Returns whether or not the background music is muted.
|
inline |
Called when the end of a media source is reached during playback.
This callback swaps the internally double buffered MediaPlayers
to achieve gapless playback.
mp | MediaPlayer that reached the end of the sample data |
|
inline |
Notifies this SoundManager of the onStart
activity lifecycle event.
This method should be called from the onStart
method in the main activity.
context | Context to be used for the MediaPlayers |
|
inline |
Notifies this SoundManager of the onStop
activity lifecycle event.
This method should be called from the onStop
method in the main activity used to create this SoundManager.
|
inline |
Sets whether or not the background music is muted.
value | true to mute the background music |
|
inline |
Sets the audio track of the specified background priority level.
priority | Background music priority level to set the audio track for |
track | Audio track asset path to load for the sound effect |
|
inline |
Sets SoundManager paused state.
This method will either stop background music from playing or resume it.
value | true to pause the background music |
|
static |
Represents an invalid background music priority level and serves as a lower bound on priority.