com.realtime.crossfire.jxclient.sound
Class ClipManager

java.lang.Object
  extended by com.realtime.crossfire.jxclient.sound.ClipManager

public class ClipManager
extends java.lang.Object

Manages a set of sound clips (short sound effects). Multiple sound effects can be played simultaneously.


Field Summary
private  ClipCache clipCache
          The clip cache used to allocate new clips.
private  java.util.concurrent.ExecutorService executorService
          The executor service used to play sound clips.
 
Constructor Summary
ClipManager(AudioFileLoader audioFileLoader, DebugWriter debugSound)
          Creates a new instance.
 
Method Summary
 void play(java.lang.String name, java.lang.String action)
          Plays the given sound effect.
 void shutdown()
          Terminates all running clips and free resources.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clipCache

@NotNull
private final ClipCache clipCache
The clip cache used to allocate new clips.


executorService

@NotNull
private final java.util.concurrent.ExecutorService executorService
The executor service used to play sound clips.

Constructor Detail

ClipManager

public ClipManager(@NotNull
                   AudioFileLoader audioFileLoader,
                   @Nullable
                   DebugWriter debugSound)
Creates a new instance.

Parameters:
audioFileLoader - the audio file loader for loading audio files
debugSound - the writer for logging sound related information or null to not log
Method Detail

play

public void play(@Nullable
                 java.lang.String name,
                 @NotNull
                 java.lang.String action)
Plays the given sound effect. This function returns immediately.

Parameters:
name - an optional prefix for the action name
action - the action name of the sound effect

shutdown

public void shutdown()
Terminates all running clips and free resources.