Package fr.formiko.kokcinelo.tools
Class Musics
java.lang.Object
fr.formiko.kokcinelo.tools.Musics
Tools class to manage music.
It aways play only one music at a time.
It have a null safety for every function.
- Since:
- 0.2
- Version:
- 1.3
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
dispose()
Dispose the current music.static float
static void
pause()
Pause the current music.static void
play()
Play the current music.static void
Set the current music and play it.static void
Play the menu music.static void
resume()
Resume the current music.static void
setLevelMusic
(String levelId) Set a level music.static void
setLooping
(boolean isLooping) Set if the current music is looping.static void
Set the current music.static void
setVolume
(float volume) Set the volume of the current music.static void
stop()
Stop the current music.
-
Method Details
-
getMusicsVolume
public static float getMusicsVolume() -
setMusic
Set the current music.- Parameters:
fileName
- name of the music file to load from musics/. It must be a mp3 file.
-
play
public static void play()Play the current music. -
resume
public static void resume()Resume the current music. -
play
Set the current music and play it.- Parameters:
fileName
- name of the music file to load from musics/. It must be a mp3 file.
-
pause
public static void pause()Pause the current music. -
stop
public static void stop()Stop the current music. -
dispose
public static void dispose()Dispose the current music. -
setVolume
public static void setVolume(float volume) Set the volume of the current music.- Parameters:
volume
- volume of the music. It must be between 0 and 1.
-
setLooping
public static void setLooping(boolean isLooping) Set if the current music is looping.- Parameters:
isLooping
- true if the music is looping.
-
playMenuMusic
public static void playMenuMusic()Play the menu music. -
setLevelMusic
Set a level music.- Parameters:
levelId
- id of the level
-