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 TypeMethodDescriptionvoid
play
(@Nullable CharSequence name) Plays the given music.void
setEnabled
(boolean enabled) Sets whether background music is enabled.void
setMuted
(boolean muted) Sets whether background music is muted.void
shutdown()
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 ornull
to not log
-
-
Method Details
-
play
Plays the given music. If the new music name is unchanged, continue playing.- Parameters:
name
- the music name, ornull
to 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.
-