java.lang.Objectcom.realtime.crossfire.jxclient.sound.MusicManager
public class MusicManager
Plays background music. At most one background music can be concurrently active (except for fading in/out effects).
| Field Summary | |
|---|---|
private AudioFileLoader |
audioFileLoader
The AudioFileLoader for loading audio files. |
private DebugWriter |
debugSound
The writer for logging sound related information or null to
not log. |
private boolean |
enabled
Whether background music is enabled. |
private boolean |
muted
Whether background music is muted. |
private java.lang.String |
name
The currently playing music name. |
private Processor |
processor
The currently running processor, or null if none is active
or if music is disabled. |
private java.lang.Thread |
thread
The Thread executing processor. |
| Constructor Summary | |
|---|---|
MusicManager(AudioFileLoader audioFileLoader,
DebugWriter debugSound)
Creates a new instance. |
|
| Method Summary | |
|---|---|
void |
play(java.lang.String name)
Plays the given music. |
private void |
restart()
Restarts the current 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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@NotNull private final AudioFileLoader audioFileLoader
AudioFileLoader for loading audio files.
@Nullable private final DebugWriter debugSound
null to
not log.
private boolean enabled
private boolean muted
@Nullable private java.lang.String name
null if no music is
playing.
@Nullable private Processor processor
null if none is active
or if music is disabled.
@Nullable private java.lang.Thread thread
Thread executing processor. Set to null
if none is executing.
| Constructor Detail |
|---|
public MusicManager(@NotNull
AudioFileLoader audioFileLoader,
@Nullable
DebugWriter debugSound)
audioFileLoader - the audio file loader for loading audio filesdebugSound - the writer for logging sound related information or
null to not log| Method Detail |
|---|
public void play(@Nullable
java.lang.String name)
name - the music name, or null to stop playing musicprivate void restart()
enabled and muted settings.
public void setEnabled(boolean enabled)
enabled - whether background music is enabledpublic void setMuted(boolean muted)
muted - whether background music is mutedpublic void shutdown()