22 package com.realtime.crossfire.jxclient.sound;
28 import java.util.Collection;
29 import java.util.EnumSet;
30 import org.jetbrains.annotations.NotNull;
31 import org.jetbrains.annotations.Nullable;
76 @SuppressWarnings(
"FieldCanBeLocal")
86 public void metaserver() {
92 public void preConnecting(@NotNull
final String serverInfo) {
97 public void connecting(@NotNull
final String serverInfo) {
108 public void connected() {
114 public void connectFailed(@NotNull
final String reason) {
128 clipManager =
new ClipManager(audioFileLoader, debugSound);
129 musicManager =
new MusicManager(audioFileLoader, debugSound);
139 if (this.enabled == enabled) {
153 public void playClip(@NotNull
final Sounds type, @Nullable
final String name, @NotNull
final String action) {
155 if (debugSound != null) {
156 debugSound.
debugProtocolWrite(
"playClip(type="+type+
", name="+name+
", action="+action+
"): sound is muted");
161 if (mutedSounds.contains(type)) {
162 if (debugSound != null) {
163 debugSound.
debugProtocolWrite(
"playClip(type="+type+
", name="+name+
", action="+action+
"): sound type is muted");
168 if (debugSound != null) {
169 debugSound.
debugProtocolWrite(
"playClip(type="+type+
", name="+name+
", action="+action+
")");
171 clipManager.
play(name, action);
181 mutedSounds.add(type);
183 mutedSounds.remove(type);
194 musicManager.
play(name);
209 if (debugSound != null) {
void shutdown()
Terminates all sounds and free resources.
Interface for listeners interested gui state changes.
Maintains the current GuiState.
void setMuted(final boolean muted)
Sets whether background music is muted.
final MusicManager musicManager
The music manager for playing background music.
void shutdown()
Terminates all running clips and free resources.
void debugProtocolWrite(@NotNull final CharSequence str)
Writes a message to the debug protocol.
final GuiStateListener guiStateListener
The GuiStateListener for detecting established or dropped connections.
void muteMusic(final boolean muted)
Mutes or unmutes background music.
Writer debug information to a log file.
void shutdown()
Terminates a playing background music and free resources.
void play(@Nullable final String name, @NotNull final String action)
Plays the given sound effect.
final ClipManager clipManager
The clip manager for playing sound effects.
void mute(@NotNull final Sounds type, final boolean mute)
Mutes or unmutes sound effects.
void playClip(@NotNull final Sounds type, @Nullable final String name, @NotNull final String action)
Plays a sound clip.
void play(@Nullable final String name)
Plays the given music.
final DebugWriter debugSound
The writer for logging sound related information or.
SoundManager(@NotNull final GuiStateManager guiStateManager, @Nullable final DebugWriter debugSound)
Creates a new instance.
void setEnabled(final boolean enabled)
Sets whether the sound system is enabled.
Manages a set of sound clips (short sound effects).
A character related sound event.
void setEnabled(final boolean enabled)
Sets whether background music is enabled.
final Collection< Sounds > mutedSounds
The muted sounds.
void playMusic(@Nullable final String name)
Plays a background music.
boolean enabled
Whether sound is enabled.
Connection progress states of the Crossfire server connection.