java.lang.Objectcom.realtime.crossfire.jxclient.sound.SoundManager
public class SoundManager
Manages all sounds. Each sound has a sound type (Sounds) attached.
Sound types can be disabled (by the user) or muted (by the application). A
sound is played only if it is neither disabled nor muted.
| Field Summary | |
|---|---|
private ClipManager |
clipManager
The clip manager for playing sound effects. |
private DebugWriter |
debugSound
The writer for logging sound related information or null to
not log. |
private boolean |
enabled
Whether sound is enabled. |
private GuiStateListener |
guiStateListener
The GuiStateListener for detecting established or dropped
connections. |
private MusicManager |
musicManager
The music manager for playing background music. |
private java.util.Collection<Sounds> |
mutedSounds
The muted sounds. |
| Constructor Summary | |
|---|---|
SoundManager(GuiStateManager guiStateManager,
DebugWriter debugSound)
Creates a new instance. |
|
| Method Summary | |
|---|---|
private void |
mute(Sounds type,
boolean mute)
Mutes or unmutes sound effects. |
private void |
muteMusic(boolean muted)
Mutes or unmutes background music. |
void |
playClip(Sounds type,
java.lang.String name,
java.lang.String action)
Plays a sound clip. |
void |
playMusic(java.lang.String name)
Plays a background music. |
void |
setEnabled(boolean enabled)
Sets whether the sound system is enabled. |
void |
shutdown()
Terminates all sounds 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 ClipManager clipManager
@Nullable private final DebugWriter debugSound
null to
not log.
private boolean enabled
@NotNull private final GuiStateListener guiStateListener
GuiStateListener for detecting established or dropped
connections.
@NotNull private final MusicManager musicManager
@NotNull private final java.util.Collection<Sounds> mutedSounds
| Constructor Detail |
|---|
public SoundManager(@NotNull
GuiStateManager guiStateManager,
@Nullable
DebugWriter debugSound)
guiStateManager - the gui state manager to watchdebugSound - the writer for logging sound related information or
null to not log| Method Detail |
|---|
private void mute(@NotNull
Sounds type,
boolean mute)
type - the sound type to affectmute - whether to mute (true) or unmute
(false)private void muteMusic(boolean muted)
muted - whether to mute (true) or unmute
(false)
public void playClip(@NotNull
Sounds type,
@Nullable
java.lang.String name,
@NotNull
java.lang.String action)
type - the sound typename - an optional prefix for the action nameaction - the sound action name
public void playMusic(@Nullable
java.lang.String name)
name - the music namepublic void setEnabled(boolean enabled)
enabled - whether the sound system is enabledpublic void shutdown()