public class ClipCache
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private AudioFileLoader |
audioFileLoader
The
AudioFileLoader for loading audio files. |
private DebugWriter |
debugSound
The writer for logging sound related information or
null to not
log. |
Constructor and Description |
---|
ClipCache(AudioFileLoader audioFileLoader,
DebugWriter debugSound)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
javax.sound.sampled.DataLine |
allocateClip(java.lang.String name,
java.lang.String action)
Allocates a new clip.
|
void |
freeClip(javax.sound.sampled.Line clip)
Deallocates a clip.
|
private javax.sound.sampled.DataLine |
newClip(java.lang.String name,
java.lang.String action)
Allocates a new clip.
|
@NotNull private final AudioFileLoader audioFileLoader
AudioFileLoader
for loading audio files.@Nullable private final DebugWriter debugSound
null
to not
log.public ClipCache(@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 log@Nullable public javax.sound.sampled.DataLine allocateClip(@Nullable java.lang.String name, @NotNull java.lang.String action)
name
- an optional prefix for the action nameaction
- the action name of the clip to allocatenull
if an error occurspublic void freeClip(@NotNull javax.sound.sampled.Line clip)
clip
- the clip to deallocate@Nullable private javax.sound.sampled.DataLine newClip(@Nullable java.lang.String name, @NotNull java.lang.String action)
name
- an optional prefix for the action nameaction
- the action name of the clip to allocatenull
if an error occurs