public class AudioPlayer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static boolean |
SOUND_OFF
Boolean indicating a mute state.
|
static boolean |
SOUND_ON
Boolean indicating sound output is ON.
|
Modifier and Type | Method and Description |
---|---|
boolean |
getAudioOutputState()
Getter for the current state of the audio output.
|
java.lang.String |
getCurrentSoundTitle()
Get the name of the currently selected file in the play list.
|
static AudioPlayer |
getInstance() |
int |
getVolume()
Get the volume value.
|
void |
loadPlaylist(Playlist Playlist)
Load a
Playlist in the AudioPlayer . |
void |
mute()
Mute audio output.
|
void |
next(int duration)
Plays the next file in the
Playlist .. |
void |
pause()
Pause the file currently playing.
|
void |
play(AudioFile audioFile,
int duration)
Plays an
AudioFile . |
void |
play(int duration)
Plays the currently selected file in the Playlist.
|
void |
previous(int duration)
Plays the previous file in the
Playlist . |
void |
restartPlaylist()
Set the
Playlist to the first {link @AudioFile}. |
void |
setPlaylistByIndex(int index)
Read the file selected by the index on the
Playlist . |
void |
setVolume(int volume)
Set the volume in percentage.
|
void |
unmute()
Un-mute audio output.
|
public static final boolean SOUND_OFF
public static final boolean SOUND_ON
public static AudioPlayer getInstance()
AudioPlayer
.public void loadPlaylist(Playlist Playlist)
Playlist
in the AudioPlayer
.
Using a Playlist with an AudioPlayer
is not required.
You may chose not to initialize the Playlist
.
The next / previous will do nothing if no Playlist
is initialized.Playlist
- Playlist
to load into the audio player.public void play(AudioFile audioFile, int duration) throws java.io.IOException
AudioFile
. This function will blocks for duration seconds.
If a file is already playing, it will stop playing this file and the selected AudioFile.audioFile
- AudioFile
to play.duration
- in seconds, how long will be the file be played.java.io.IOException
- Low level code failed or has not been initialized.public void play(int duration) throws java.io.IOException
duration
- in seconds, how long will the file be played.java.io.IOException
- Low level code failed or has not been initialized.public void next(int duration) throws java.io.IOException
Playlist
..
This function will blocks for @param duration seconds.
This methods does nothing if you haven't loaded a Playlist
..
If a file is already playing, it will stop playing this file and the selected AudioFile.duration
- in seconds, how long will the file be played.java.io.IOException
- Low level code failed or has not been initialized.public void previous(int duration) throws java.io.IOException
Playlist
.
This function will blocks for duration seconds.
This methods does nothing if you haven't loaded a Playlist
.
If a file is already playing, it will stop playing this file and the selected AudioFile.duration
- in seconds, how long will the file be played.java.io.IOException
- Low level code failed or has not been initialized.public void pause() throws java.io.IOException
java.io.IOException
- Low level code failed or has not been initialized.public void setVolume(int volume)
volume
- volume in percentage.public int getVolume()
public void mute()
public void unmute()
public boolean getAudioOutputState()
AudioPlayer
is not muted. Return false otherwise.public java.lang.String getCurrentSoundTitle()
Playlist
is not initialized.public void restartPlaylist()
Playlist
to the first {link @AudioFile}.