Crossfire JXClient, Trunk
R20561
|
Plays background music. More...
Public Member Functions | |
MusicManager (@NotNull final AudioFileLoader audioFileLoader, @Nullable final DebugWriter debugSound) | |
Creates a new instance. More... | |
void | play (@Nullable final String name) |
Plays the given music. More... | |
void | setEnabled (final boolean enabled) |
Sets whether background music is enabled. More... | |
void | setMuted (final boolean muted) |
Sets whether background music is muted. More... | |
void | shutdown () |
Terminates a playing background music and free resources. More... | |
Private Member Functions | |
void | restart () |
Restarts the current music. More... | |
Private Attributes | |
final AudioFileLoader | audioFileLoader |
The AudioFileLoader for loading audio files. More... | |
final DebugWriter | debugSound |
The writer for logging sound related information or. More... | |
boolean | enabled |
Whether background music is enabled. More... | |
boolean | muted = true |
Whether background music is muted. More... | |
String | name |
The currently playing music name. More... | |
Processor | processor |
The currently running processor, or. More... | |
Thread | thread |
The Thread executing processor. More... | |
Plays background music.
At most one background music can be concurrently active (except for fading in/out effects).
Definition at line 33 of file MusicManager.java.
com.realtime.crossfire.jxclient.sound.MusicManager.MusicManager | ( | @NotNull final AudioFileLoader | audioFileLoader, |
@Nullable final DebugWriter | debugSound | ||
) |
Creates a new instance.
audioFileLoader | the audio file loader for loading audio files |
debugSound | the writer for logging sound related information or null |
Definition at line 85 of file MusicManager.java.
References com.realtime.crossfire.jxclient.sound.MusicManager.audioFileLoader, and com.realtime.crossfire.jxclient.sound.MusicManager.debugSound.
void com.realtime.crossfire.jxclient.sound.MusicManager.play | ( | @Nullable final String | name | ) |
Plays the given music.
If the new music name is unchanged, continue playing.
name | the music name, or null |
Definition at line 95 of file MusicManager.java.
References com.realtime.crossfire.jxclient.util.DebugWriter.debugProtocolWrite(), com.realtime.crossfire.jxclient.sound.MusicManager.name, and com.realtime.crossfire.jxclient.sound.MusicManager.restart().
Referenced by com.realtime.crossfire.jxclient.sound.SoundManager.playMusic().
|
private |
Restarts the current music.
Take into account enabled and muted settings.
Definition at line 143 of file MusicManager.java.
References com.realtime.crossfire.jxclient.sound.Processor.terminate().
Referenced by com.realtime.crossfire.jxclient.sound.MusicManager.play(), com.realtime.crossfire.jxclient.sound.MusicManager.setEnabled(), and com.realtime.crossfire.jxclient.sound.MusicManager.setMuted().
void com.realtime.crossfire.jxclient.sound.MusicManager.setEnabled | ( | final boolean | enabled | ) |
Sets whether background music is enabled.
enabled | whether background music is enabled |
Definition at line 111 of file MusicManager.java.
References com.realtime.crossfire.jxclient.util.DebugWriter.debugProtocolWrite(), com.realtime.crossfire.jxclient.sound.MusicManager.enabled, and com.realtime.crossfire.jxclient.sound.MusicManager.restart().
Referenced by com.realtime.crossfire.jxclient.sound.SoundManager.setEnabled().
void com.realtime.crossfire.jxclient.sound.MusicManager.setMuted | ( | final boolean | muted | ) |
Sets whether background music is muted.
muted | whether background music is muted |
Definition at line 127 of file MusicManager.java.
References com.realtime.crossfire.jxclient.util.DebugWriter.debugProtocolWrite(), com.realtime.crossfire.jxclient.sound.MusicManager.muted, and com.realtime.crossfire.jxclient.sound.MusicManager.restart().
Referenced by com.realtime.crossfire.jxclient.sound.SoundManager.muteMusic().
void com.realtime.crossfire.jxclient.sound.MusicManager.shutdown | ( | ) |
Terminates a playing background music and free resources.
Definition at line 159 of file MusicManager.java.
References com.realtime.crossfire.jxclient.sound.Processor.terminate().
Referenced by com.realtime.crossfire.jxclient.sound.SoundManager.shutdown().
|
private |
The AudioFileLoader for loading audio files.
Definition at line 39 of file MusicManager.java.
Referenced by com.realtime.crossfire.jxclient.sound.MusicManager.MusicManager().
|
private |
The writer for logging sound related information or.
to not log.
Definition at line 46 of file MusicManager.java.
Referenced by com.realtime.crossfire.jxclient.sound.MusicManager.MusicManager().
|
private |
Whether background music is enabled.
(User setting)
Definition at line 65 of file MusicManager.java.
Referenced by com.realtime.crossfire.jxclient.sound.MusicManager.setEnabled().
|
private |
Whether background music is muted.
(Depends on connection state)
Definition at line 70 of file MusicManager.java.
Referenced by com.realtime.crossfire.jxclient.sound.MusicManager.setMuted().
|
private |
The currently playing music name.
Set to
if no music is playing.
Definition at line 77 of file MusicManager.java.
Referenced by com.realtime.crossfire.jxclient.sound.MusicManager.play().
|
private |
The currently running processor, or.
if none is active or if music is disabled.
Definition at line 53 of file MusicManager.java.
|
private |
The Thread executing processor.
Set to
if none is executing.
Definition at line 60 of file MusicManager.java.