public class AndroidMini2DxAudio extends java.lang.Object implements Audio, com.badlogic.gdx.Audio
AndroidAudio to support sound completion events| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<AndroidMini2DxMusic> |
musics |
| Constructor and Description |
|---|
AndroidMini2DxAudio(Context context,
AndroidApplicationConfiguration config) |
| Modifier and Type | Method and Description |
|---|---|
void |
addMusicCompletionListener(MusicCompletionListener completionListener)
Adds a
MusicCompletionListener |
void |
addSoundCompletionListener(SoundCompletionListener listener)
Adds a
SoundCompletionListener |
void |
appendRecentSoundId(long streamId) |
void |
dispose()
Kills the soundpool and all other resources
|
com.badlogic.gdx.audio.AudioDevice |
newAudioDevice(int samplingRate,
boolean isMono) |
com.badlogic.gdx.audio.AudioRecorder |
newAudioRecorder(int samplingRate,
boolean isMono) |
Music |
newMusic(FileHandle fileHandle)
Creates a new
Music instance used to play back an audio stream from a file. |
com.badlogic.gdx.audio.Music |
newMusic(com.badlogic.gdx.files.FileHandle file) |
Sound |
newSound(FileHandle fileHandle)
Creates a new
Sound instance used to play back audio sound effects (e.g. |
com.badlogic.gdx.audio.Sound |
newSound(com.badlogic.gdx.files.FileHandle fileHandle) |
protected void |
pause() |
void |
removeMusicCompletionListener(MusicCompletionListener completionListener)
Removes a
MusicCompletionListener |
void |
removeSoundCompletionListener(SoundCompletionListener listener)
Removes a
SoundCompletionListener |
protected void |
resume() |
void |
update() |
protected final java.util.List<AndroidMini2DxMusic> musics
public AndroidMini2DxAudio(Context context,
AndroidApplicationConfiguration config)
public void update()
public void appendRecentSoundId(long streamId)
public Sound newSound(FileHandle fileHandle) throws java.io.IOException
Audio
Creates a new Sound instance used to play back audio sound effects (e.g. explosions, gunshots, etc.).
Note that the complete audio data is loaded into RAM and you should avoid loading large files.
The current upper limit for decoded audio is 1 MB.
Currently supported formats are WAV, MP3 and OGG.
When the Sound instance is no longer needed, call the Disposable.dispose() method
fileHandle - The FileHandle to load the audio fromSound instancejava.io.IOException - Thrown when the sound could not be loadedpublic Music newMusic(FileHandle fileHandle) throws java.io.IOException
Audio
Creates a new Music instance used to play back an audio stream from a file.
Music instances are automatically paused when the application is paused and resumed when the application is resumed.
Currently supported formats are WAV, MP3 and OGG.
When the Music instance is no longer needed, call the Disposable.dispose() method
fileHandle - The FileHandle to stream the audio fromMusic instancejava.io.IOException - Thrown when the music could not be loadedpublic void addMusicCompletionListener(MusicCompletionListener completionListener)
AudioMusicCompletionListenercompletionListener - The MusicCompletionListener to be notified of Music completion events.public void removeMusicCompletionListener(MusicCompletionListener completionListener)
AudioMusicCompletionListenercompletionListener - The MusicCompletionListener to be removedpublic void addSoundCompletionListener(SoundCompletionListener listener)
AudioSoundCompletionListenerlistener - The SoundCompletionListener to be notified of Sound completion events.public void removeSoundCompletionListener(SoundCompletionListener listener)
AudioSoundCompletionListenerlistener - The SoundCompletionListener to be removedprotected void pause()
protected void resume()
public void dispose()
public com.badlogic.gdx.audio.AudioDevice newAudioDevice(int samplingRate,
boolean isMono)
newAudioDevice in interface com.badlogic.gdx.Audiopublic com.badlogic.gdx.audio.AudioRecorder newAudioRecorder(int samplingRate,
boolean isMono)
newAudioRecorder in interface com.badlogic.gdx.Audiopublic com.badlogic.gdx.audio.Sound newSound(com.badlogic.gdx.files.FileHandle fileHandle)
newSound in interface com.badlogic.gdx.Audiopublic com.badlogic.gdx.audio.Music newMusic(com.badlogic.gdx.files.FileHandle file)
newMusic in interface com.badlogic.gdx.Audio