Class MusicManager
- java.lang.Object
-
- com.realtime.crossfire.jxclient.sound.MusicManager
-
public class MusicManager extends java.lang.ObjectPlays background music. At most one background music can be concurrently active (except for fading in/out effects).
-
-
Constructor Summary
Constructors Constructor Description MusicManager(@NotNull AudioFileLoader audioFileLoader, @Nullable DebugWriter debugSound)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidplay(@Nullable java.lang.String 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 Detail
-
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 Detail
-
play
public void play(@Nullable @Nullable java.lang.String name)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.
-
-