22 package com.realtime.crossfire.jxclient.sound;
25 import org.jetbrains.annotations.NotNull;
26 import org.jetbrains.annotations.Nullable;
95 public void play(@Nullable
final String name) {
96 if (this.name == null ? name == null : this.name.equals(name)) {
100 if (debugSound != null) {
112 if (this.enabled == enabled) {
116 if (debugSound != null) {
128 if (this.muted == muted) {
132 if (debugSound != null) {
144 if (processor != null) {
149 if (enabled && !muted && name != null) {
150 processor =
new Processor(name, audioFileLoader);
151 thread =
new Thread(processor,
"JXClient:MusicManager");
160 if (processor != null) {
164 if (thread != null) {
167 }
catch (
final InterruptedException ex) {
168 throw new AssertionError(ex);
boolean muted
Whether background music is muted.
void setMuted(final boolean muted)
Sets whether background music is muted.
final AudioFileLoader audioFileLoader
The AudioFileLoader for loading audio files.
void debugProtocolWrite(@NotNull final CharSequence str)
Writes a message to the debug protocol.
A thread that plays a music file over and over until terminated.
Writer debug information to a log file.
void shutdown()
Terminates a playing background music and free resources.
void play(@Nullable final String name)
Plays the given music.
Thread thread
The Thread executing processor.
void terminate(final boolean fadeOut)
Stops playing music.
final DebugWriter debugSound
The writer for logging sound related information or.
MusicManager(@NotNull final AudioFileLoader audioFileLoader, @Nullable final DebugWriter debugSound)
Creates a new instance.
void setEnabled(final boolean enabled)
Sets whether background music is enabled.
boolean enabled
Whether background music is enabled.
String name
The currently playing music name.
Processor processor
The currently running processor, or.
void restart()
Restarts the current music.