Package fr.formiko.usuel.media.audio
Class MusicPlayer
java.lang.Object
fr.formiko.usuel.media.audio.MusicPlayer
- All Implemented Interfaces:
AudioInterface
to listen music.
It use audioPlayer & make sur than only 1 is running at the same time.
It use audioPlayer & make sur than only 1 is running at the same time.
- Author:
- Hydrolien
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AudioPlayerprivate GStringprivate Stringprivate booleanprivate GString -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNextMusic(String music, boolean first)Add next music to list of music to play.private Stringreturn a music.getPath()private Stringreturn a random music.voidInitialize availables musics list.voidnext()Play next music.voidpause()Pause curent music.voidplay()Play next music.voidresume()Resume curent music.voidstop()Stop curent music.
-
Field Details
-
audioPlayer
-
musicPaused
private boolean musicPaused -
nextMusics
-
availableMusics
-
curentMusic
-
-
Constructor Details
-
MusicPlayer
public MusicPlayer()
-
-
Method Details
-
getPath
-
play
public void play()Play next music.- Specified by:
playin interfaceAudioInterface
-
pause
public void pause()Pause curent music.- Specified by:
pausein interfaceAudioInterface- See Also:
resume()
-
resume
public void resume()Resume curent music.- Specified by:
resumein interfaceAudioInterface- See Also:
pause()
-
stop
public void stop()Stop curent music.
We need play() to start music again.- Specified by:
stopin interfaceAudioInterface
-
addNextMusic
Add next music to list of music to play.- Parameters:
music- name of the music.first- If true add music at the head of the list. Else add at the end.
-
next
public void next()Play next music. -
iniAvailableMusics
public void iniAvailableMusics()Initialize availables musics list. -
getNextMusic
return a music.
If there is a next music, it return next Music. If next music list is empty, it return a random music. -
getRandomMusic
return a random music.
If the list of availableMusics is null, it create it.
It should avoid to play same music than curent one by gettin a new random 1 (10 try).
-