Package fr.formiko.usuel.media.audio
Class AudioPlayer
java.lang.Object
fr.formiko.usuel.media.audio.AudioPlayer
- All Implemented Interfaces:
AudioInterface
to read and launch audio file.
cf https://odoepner.wordpress.com/2013/07/19/play-mp3-or-ogg-using-javax-sound-sampled-mp3spi-vorbisspi/
cf https://odoepner.wordpress.com/2013/07/19/play-mp3-or-ogg-using-javax-sound-sampled-mp3spi-vorbisspi/
- Author:
- Hydrolien, Oliver Doepner
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAudioPlayer(boolean isMusique, String fileName)
secondary constructorAudioPlayer(String fileName)
secondary constructorAudioPlayer(String fileName, boolean loop)
secondary constructorAudioPlayer(String fileName, boolean loop, int maxTime)
secondary constructorAudioPlayer(String fileName, boolean loop, int maxTime, boolean isMusique)
main constructorAudioPlayer(String fileName, int maxTime)
secondary constructor -
Method Summary
Modifier and TypeMethodDescriptionprivate void
doSounds()
getFile()
boolean
boolean
getLoop()
int
void
pause()
pause audio & timevoid
play()
play audio & launch timevoid
resume()
Resume audio & time.void
void
void
setIsMusique(boolean f)
void
setLoop(boolean f)
void
setMaxTime(int f)
void
setVolume(int vol)
Modify volume.void
stop()
Stop audio & time.
-
Field Details
-
file
-
loop
private boolean loop -
maxTime
private int maxTime -
chrono
-
at
-
isMusique
private boolean isMusique -
volume
private float volume
-
-
Constructor Details
-
AudioPlayer
main constructor- Parameters:
fileName
- name of the file.loop
- if true, we will loop when audio end.maxTime
- time to stop.isMusique
- true if this audio player is for a music (That's meen that MusicPlayer need to play next after this).
-
AudioPlayer
secondary constructor- Parameters:
fileName
- name of the file.loop
- if true, we will loop when audio end.maxTime
- time to stop.
-
AudioPlayer
secondary constructor- Parameters:
fileName
- name of the file.loop
- if true, we will loop when audio end.
-
AudioPlayer
secondary constructor- Parameters:
fileName
- name of the file.isMusique
- true if this audio player is for a music (That's meen that MusicPlayer need to play next after this).
-
AudioPlayer
secondary constructor- Parameters:
fileName
- name of the file.maxTime
- time to stop.
-
AudioPlayer
secondary constructor- Parameters:
fileName
- name of the file.
-
-
Method Details
-
getFile
-
setFile
-
getLoop
public boolean getLoop() -
setLoop
public void setLoop(boolean f) -
getMaxTime
public int getMaxTime() -
setMaxTime
public void setMaxTime(int f) -
getChrono
-
setChrono
-
getIsMusique
public boolean getIsMusique() -
setIsMusique
public void setIsMusique(boolean f) -
play
public void play()play audio & launch time- Specified by:
play
in interfaceAudioInterface
-
pause
public void pause()pause audio & time- Specified by:
pause
in interfaceAudioInterface
-
resume
public void resume()Resume audio & time.- Specified by:
resume
in interfaceAudioInterface
-
stop
public void stop()Stop audio & time.- Specified by:
stop
in interfaceAudioInterface
-
setVolume
public void setVolume(int vol)Modify volume.- Parameters:
vol
- volume in %
-
doSounds
private void doSounds()
-