Package tripleplay.sound
Class MultiClip
java.lang.Object
tripleplay.sound.MultiClip
Provides a sound clip that can be played multiple times. Callers tell the multiclip to prepare a
copy which may result in loading a copy of the sound from a
SoundBoard
if no reserves
are available to play it, they then play the sound, and after a configured duration that sound
either goes back into the reserves, or is disposed, if the reserves are already full.-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionMultiClip
(SoundBoard board, String path, int reserveCopies, float duration) Creates a multiclip with the supplied configuration. -
Method Summary
-
Constructor Details
-
MultiClip
Creates a multiclip with the supplied configuration.- Parameters:
board
- the soundboard from which to obtain clips.path
- the path to the underlying sound.reserveCopies
- the minimum number of copies of the sound to keep in memory.duration
- the duration of the sound (in seconds). This will be used to determine when it is safe to reuse a copy of the sound.
-
-
Method Details
-
reserve
Obtains a copy of the sound (from the reserves if possible or loaded from storage if not). The copy must beMultiClip.Copy.play()
ed orMultiClip.Copy.release()
d by the caller. -
release
public void release()Releases all of the clips obtained by this multiclip, freeing their audio resources.
-