java.lang.Object com.realtime.crossfire.jxclient.sound.ClipManager
public class ClipManager
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 |
---|
@NotNull private final ClipCache clipCache
@NotNull private final java.util.concurrent.ExecutorService executorService
Constructor Detail |
---|
public ClipManager(@NotNull AudioFileLoader audioFileLoader, @Nullable DebugWriter debugSound)
audioFileLoader
- the audio file loader for loading audio filesdebugSound
- the writer for logging sound related information or
null
to not logMethod Detail |
---|
public void play(@Nullable java.lang.String name, @NotNull java.lang.String action)
name
- an optional prefix for the action nameaction
- the action name of the sound effectpublic void shutdown()