Class MusicManager
java.lang.Object
com.realtime.crossfire.jxclient.sound.MusicManager
Plays background music. At most one background music can be concurrently
active (except for fading in/out effects).
-
Constructor Summary
ConstructorsConstructorDescriptionMusicManager(@NotNull AudioFileLoader audioFileLoader, @Nullable DebugWriter debugSound) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidplay(@Nullable CharSequence name) Plays the given music.voidsetEnabled(boolean enabled) Sets whether background music is enabled.voidsetMuted(boolean muted) Sets whether background music is muted.voidshutdown()Terminates a playing background music and free resources.
-
Constructor Details
-
MusicManager
public MusicManager(@NotNull @NotNull AudioFileLoader audioFileLoader, @Nullable @Nullable DebugWriter debugSound) Creates a new instance.- Parameters:
audioFileLoader- the audio file loader for loading audio filesdebugSound- the writer for logging sound related information ornullto not log
-
-
Method Details
-
play
Plays the given music. If the new music name is unchanged, continue playing.- Parameters:
name- the music name, ornullto stop playing music
-
setEnabled
public void setEnabled(boolean enabled) Sets whether background music is enabled.- Parameters:
enabled- whether background music is enabled
-
setMuted
public void setMuted(boolean muted) Sets whether background music is muted.- Parameters:
muted- whether background music is muted
-
shutdown
public void shutdown()Terminates a playing background music and free resources.
-