Crossfire JXClient, Trunk
|
Classes | |
class | AbstractTask |
class | ClipFreeTask |
class | ClipLoadTask |
class | ClipPlayTask |
class | ClipStartTask |
class | ClipStopTask |
interface | Task |
Public Member Functions | |
ClipManager (@NotNull final AudioFileLoader audioFileLoader, @Nullable final DebugWriter debugSound, @NotNull final SoundTaskExecutor soundTaskExecutor) | |
void | play (@NotNull final CharSequence action) |
void | shutdown () throws InterruptedException |
Private Member Functions | |
void | playClips () |
Private Attributes | |
final ClipLoader | clipLoader |
final Semaphore | concurrentClips = new Semaphore(8) |
final DebugWriter | debugSound |
final CompletionService< @Nullable Task > | executorCompletionService = new ExecutorCompletionService<>(executorService) |
final ExecutorService | executorService = Executors.newCachedThreadPool() |
int | nextClipId |
final SoundTaskExecutor | soundTaskExecutor |
Manages a set of sound clips (short sound effects). Multiple sound effects can be played simultaneously.
Definition at line 43 of file ClipManager.java.
com.realtime.crossfire.jxclient.sound.ClipManager.ClipManager | ( | @NotNull final AudioFileLoader | audioFileLoader, |
@Nullable final DebugWriter | debugSound, | ||
@NotNull final SoundTaskExecutor | soundTaskExecutor | ||
) |
Creates a new instance.
audioFileLoader | the audio file loader for loading audio files |
debugSound | the writer for logging sound related information or null
|
soundTaskExecutor | the global sound task executor |
Definition at line 94 of file ClipManager.java.
References com.realtime.crossfire.jxclient.sound.ClipManager.clipLoader, com.realtime.crossfire.jxclient.sound.ClipManager.debugSound, com.realtime.crossfire.jxclient.sound.ClipManager.executorService, and com.realtime.crossfire.jxclient.sound.ClipManager.soundTaskExecutor.
void com.realtime.crossfire.jxclient.sound.ClipManager.play | ( | @NotNull final CharSequence | action | ) |
Plays the given sound effect. This function returns immediately.
action | the action name of the sound effect |
Definition at line 105 of file ClipManager.java.
References com.realtime.crossfire.jxclient.sound.ClipManager.concurrentClips, com.realtime.crossfire.jxclient.util.DebugWriter.debugProtocolWrite(), com.realtime.crossfire.jxclient.sound.ClipManager.debugSound, com.realtime.crossfire.jxclient.sound.ClipManager.executorCompletionService, and com.realtime.crossfire.jxclient.sound.ClipManager.nextClipId.
Referenced by com.realtime.crossfire.jxclient.sound.SoundManager.playClip().
|
private |
Plays the scheduled sound clips.
Definition at line 120 of file ClipManager.java.
References com.realtime.crossfire.jxclient.util.DebugWriter.debugProtocolWrite(), com.realtime.crossfire.jxclient.sound.ClipManager.debugSound, com.realtime.crossfire.jxclient.sound.ClipManager.executorCompletionService, and com.realtime.crossfire.jxclient.sound.ClipManager.Task.getCallable().
void com.realtime.crossfire.jxclient.sound.ClipManager.shutdown | ( | ) | throws InterruptedException |
Terminates all running clips and free resources.
InterruptedException | if the current thread was interrupted while waiting for the shutdown |
Definition at line 171 of file ClipManager.java.
References com.realtime.crossfire.jxclient.sound.SoundTaskExecutor.executeAndWait(), and com.realtime.crossfire.jxclient.sound.ClipManager.soundTaskExecutor.
Referenced by com.realtime.crossfire.jxclient.sound.SoundManager.shutdown().
|
private |
The clip loader used to load clips.
Definition at line 74 of file ClipManager.java.
Referenced by com.realtime.crossfire.jxclient.sound.ClipManager.ClipManager(), com.realtime.crossfire.jxclient.sound.ClipManager.ClipLoadTask.getCallable(), and com.realtime.crossfire.jxclient.sound.ClipManager.ClipFreeTask.getCallable().
|
private |
Counts the number of concurrently active sound clips.
Definition at line 80 of file ClipManager.java.
Referenced by com.realtime.crossfire.jxclient.sound.ClipManager.ClipLoadTask.getCallable(), com.realtime.crossfire.jxclient.sound.ClipManager.ClipFreeTask.getCallable(), and com.realtime.crossfire.jxclient.sound.ClipManager.play().
|
private |
The writer for logging sound related information or
to not log.
Definition at line 50 of file ClipManager.java.
Referenced by com.realtime.crossfire.jxclient.sound.ClipManager.ClipManager(), com.realtime.crossfire.jxclient.sound.ClipManager.ClipLoadTask.getCallable(), com.realtime.crossfire.jxclient.sound.ClipManager.ClipStartTask.getCallable(), com.realtime.crossfire.jxclient.sound.ClipManager.ClipPlayTask.getCallable(), com.realtime.crossfire.jxclient.sound.ClipManager.ClipStopTask.getCallable(), com.realtime.crossfire.jxclient.sound.ClipManager.ClipFreeTask.getCallable(), com.realtime.crossfire.jxclient.sound.ClipManager.play(), and com.realtime.crossfire.jxclient.sound.ClipManager.playClips().
|
private |
Plays the scheduled sound clips as soon as they have been loaded.
Definition at line 68 of file ClipManager.java.
Referenced by com.realtime.crossfire.jxclient.sound.ClipManager.play(), and com.realtime.crossfire.jxclient.sound.ClipManager.playClips().
|
private |
The executor service used to play sound clips.
Definition at line 62 of file ClipManager.java.
Referenced by com.realtime.crossfire.jxclient.sound.ClipManager.ClipManager().
|
private |
The ID for the next clip.
Definition at line 85 of file ClipManager.java.
Referenced by com.realtime.crossfire.jxclient.sound.ClipManager.play().
|
private |
The global SoundTaskExecutor instance.
Definition at line 56 of file ClipManager.java.
Referenced by com.realtime.crossfire.jxclient.sound.ClipManager.ClipManager(), and com.realtime.crossfire.jxclient.sound.ClipManager.shutdown().