Crossfire JXClient, Trunk  R20561
com.realtime.crossfire.jxclient.sound.SoundManager Class Reference

Manages all sounds. More...

+ Collaboration diagram for com.realtime.crossfire.jxclient.sound.SoundManager:

Public Member Functions

void playClip (@NotNull final Sounds type, @Nullable final String name, @NotNull final String action)
 Plays a sound clip. More...
 
void playMusic (@Nullable final String name)
 Plays a background music. More...
 
void setEnabled (final boolean enabled)
 Sets whether the sound system is enabled. More...
 
void shutdown ()
 Terminates all sounds and free resources. More...
 
 SoundManager (@NotNull final GuiStateManager guiStateManager, @Nullable final DebugWriter debugSound)
 Creates a new instance. More...
 

Private Member Functions

void mute (@NotNull final Sounds type, final boolean mute)
 Mutes or unmutes sound effects. More...
 
void muteMusic (final boolean muted)
 Mutes or unmutes background music. More...
 

Private Attributes

final ClipManager clipManager
 The clip manager for playing sound effects. More...
 
final DebugWriter debugSound
 The writer for logging sound related information or. More...
 
boolean enabled
 Whether sound is enabled. More...
 
final GuiStateListener guiStateListener
 The GuiStateListener for detecting established or dropped connections. More...
 
final MusicManager musicManager
 The music manager for playing background music. More...
 
final Collection< SoundsmutedSounds = EnumSet.allOf(Sounds.class)
 The muted sounds. More...
 

Detailed Description

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.

Author
Andreas Kirschbaum

Definition at line 39 of file SoundManager.java.

Constructor & Destructor Documentation

◆ SoundManager()

com.realtime.crossfire.jxclient.sound.SoundManager.SoundManager ( @NotNull final GuiStateManager  guiStateManager,
@Nullable final DebugWriter  debugSound 
)

Creates a new instance.

Parameters
guiStateManagerthe gui state manager to watch
debugSoundthe writer for logging sound related information or
null
to not log

Definition at line 126 of file SoundManager.java.

References com.realtime.crossfire.jxclient.sound.SoundManager.debugSound, and com.realtime.crossfire.jxclient.sound.SoundManager.guiStateListener.

Member Function Documentation

◆ mute()

void com.realtime.crossfire.jxclient.sound.SoundManager.mute ( @NotNull final Sounds  type,
final boolean  mute 
)
private

Mutes or unmutes sound effects.

Parameters
typethe sound type to affect
mutewhether to mute (
true
) or unmute (
false
)

Definition at line 179 of file SoundManager.java.

◆ muteMusic()

void com.realtime.crossfire.jxclient.sound.SoundManager.muteMusic ( final boolean  muted)
private

Mutes or unmutes background music.

Parameters
mutedwhether to mute (
true
) or unmute (
false
)

Definition at line 201 of file SoundManager.java.

References com.realtime.crossfire.jxclient.sound.MusicManager.setMuted().

+ Here is the call graph for this function:

◆ playClip()

void com.realtime.crossfire.jxclient.sound.SoundManager.playClip ( @NotNull final Sounds  type,
@Nullable final String  name,
@NotNull final String  action 
)

Plays a sound clip.

Parameters
typethe sound type
namean optional prefix for the action name
actionthe sound action name

Definition at line 153 of file SoundManager.java.

References com.realtime.crossfire.jxclient.util.DebugWriter.debugProtocolWrite(), and com.realtime.crossfire.jxclient.sound.ClipManager.play().

Referenced by com.realtime.crossfire.jxclient.sound.StatsWatcher.playClip().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ playMusic()

void com.realtime.crossfire.jxclient.sound.SoundManager.playMusic ( @Nullable final String  name)

Plays a background music.

If the new music name is unchanged, continue playing.

Parameters
namethe music name

Definition at line 193 of file SoundManager.java.

References com.realtime.crossfire.jxclient.sound.MusicManager.play().

+ Here is the call graph for this function:

◆ setEnabled()

void com.realtime.crossfire.jxclient.sound.SoundManager.setEnabled ( final boolean  enabled)

Sets whether the sound system is enabled.

Parameters
enabledwhether the sound system is enabled

Definition at line 138 of file SoundManager.java.

References com.realtime.crossfire.jxclient.sound.SoundManager.enabled, and com.realtime.crossfire.jxclient.sound.MusicManager.setEnabled().

Referenced by com.realtime.crossfire.jxclient.sound.SoundCheckBoxOption.execute().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ shutdown()

void com.realtime.crossfire.jxclient.sound.SoundManager.shutdown ( )

Member Data Documentation

◆ clipManager

final ClipManager com.realtime.crossfire.jxclient.sound.SoundManager.clipManager
private

The clip manager for playing sound effects.

Definition at line 45 of file SoundManager.java.

◆ debugSound

final DebugWriter com.realtime.crossfire.jxclient.sound.SoundManager.debugSound
private

The writer for logging sound related information or.

null

to not log.

Definition at line 52 of file SoundManager.java.

Referenced by com.realtime.crossfire.jxclient.sound.SoundManager.SoundManager().

◆ enabled

boolean com.realtime.crossfire.jxclient.sound.SoundManager.enabled
private

Whether sound is enabled.

Definition at line 63 of file SoundManager.java.

Referenced by com.realtime.crossfire.jxclient.sound.SoundManager.setEnabled().

◆ guiStateListener

final GuiStateListener com.realtime.crossfire.jxclient.sound.SoundManager.guiStateListener
private

The GuiStateListener for detecting established or dropped connections.

Definition at line 77 of file SoundManager.java.

Referenced by com.realtime.crossfire.jxclient.sound.SoundManager.SoundManager().

◆ musicManager

final MusicManager com.realtime.crossfire.jxclient.sound.SoundManager.musicManager
private

The music manager for playing background music.

Definition at line 58 of file SoundManager.java.

◆ mutedSounds

final Collection<Sounds> com.realtime.crossfire.jxclient.sound.SoundManager.mutedSounds = EnumSet.allOf(Sounds.class)
private

The muted sounds.

Definition at line 69 of file SoundManager.java.


The documentation for this class was generated from the following file: