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

Plays background music. More...

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

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...
 

Detailed Description

Plays background music.

At most one background music can be concurrently active (except for fading in/out effects).

Author
Andreas Kirschbaum

Definition at line 33 of file MusicManager.java.

Constructor & Destructor Documentation

◆ MusicManager()

com.realtime.crossfire.jxclient.sound.MusicManager.MusicManager ( @NotNull final AudioFileLoader  audioFileLoader,
@Nullable final DebugWriter  debugSound 
)

Creates a new instance.

Parameters
audioFileLoaderthe audio file loader for loading audio files
debugSoundthe writer for logging sound related information or
null
to not log

Definition at line 85 of file MusicManager.java.

References com.realtime.crossfire.jxclient.sound.MusicManager.audioFileLoader, and com.realtime.crossfire.jxclient.sound.MusicManager.debugSound.

Member Function Documentation

◆ play()

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.

Parameters
namethe music name, or
null
to stop playing music

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().

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

◆ restart()

void com.realtime.crossfire.jxclient.sound.MusicManager.restart ( )
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().

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

◆ setEnabled()

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

Sets whether background music is enabled.

Parameters
enabledwhether 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().

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

◆ setMuted()

void com.realtime.crossfire.jxclient.sound.MusicManager.setMuted ( final boolean  muted)

Sets whether background music is muted.

Parameters
mutedwhether 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().

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

◆ shutdown()

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().

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

Member Data Documentation

◆ audioFileLoader

final AudioFileLoader com.realtime.crossfire.jxclient.sound.MusicManager.audioFileLoader
private

The AudioFileLoader for loading audio files.

Definition at line 39 of file MusicManager.java.

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

◆ debugSound

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

The writer for logging sound related information or.

null

to not log.

Definition at line 46 of file MusicManager.java.

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

◆ enabled

boolean com.realtime.crossfire.jxclient.sound.MusicManager.enabled
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().

◆ muted

boolean com.realtime.crossfire.jxclient.sound.MusicManager.muted = true
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().

◆ name

String com.realtime.crossfire.jxclient.sound.MusicManager.name
private

The currently playing music name.

Set to

null

if no music is playing.

Definition at line 77 of file MusicManager.java.

Referenced by com.realtime.crossfire.jxclient.sound.MusicManager.play().

◆ processor

Processor com.realtime.crossfire.jxclient.sound.MusicManager.processor
private

The currently running processor, or.

null

if none is active or if music is disabled.

Definition at line 53 of file MusicManager.java.

◆ thread

Thread com.realtime.crossfire.jxclient.sound.MusicManager.thread
private

The Thread executing processor.

Set to

null

if none is executing.

Definition at line 60 of file MusicManager.java.


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