Package playn.core
Class SoundImpl<I>
java.lang.Object
playn.core.Sound
playn.core.SoundImpl<I>
An implementation detail. Not part of the public API.
-
Nested Class Summary
Nested classes/interfaces inherited from class playn.core.Sound
Sound.Error -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidConfigures this sound with an error in lieu of its platform implementation.booleanDetermine whether this audio stream is currently playing.booleanplay()If possible, begin playback of this audio stream.booleanprepare()Prepares this sound to be played by preloading it into audio buffers.voidrelease()Releases resources used by this sound.voidsetLooping(boolean looping) Set whether audio stream playback should be looped indefinitely or not.voidsetVolume(float volume) voidstop()Stop playback of the current audio stream as soon as possible, and reset the sound position to its starting position, such that a subsequent call toSound.play()will cause the audio file to being playback from the beginning of the audio stream.voidConfigures this sound with its platform implementation.floatvolume()
-
Constructor Details
-
SoundImpl
-
-
Method Details
-
succeed
Configures this sound with its platform implementation. This may be called from any thread. -
fail
Configures this sound with an error in lieu of its platform implementation. This may be called from any thread. -
prepare
public boolean prepare()Description copied from class:SoundPrepares this sound to be played by preloading it into audio buffers. This expresses a desire to have subsequent calls toSound.play()start emitting sound with the lowest possible latency. -
isPlaying
public boolean isPlaying()Description copied from class:SoundDetermine whether this audio stream is currently playing. -
play
public boolean play()Description copied from class:SoundIf possible, begin playback of this audio stream. The audio system will make best efforts to playback this sound. However, lack of audio or codec support, or a (temporary) unavailability of audio channels may prevent playback. If the audio system is certain that audio playback failed, this method will return false. However, a return value of true does not guarantee that playback will in fact succeed. -
stop
public void stop()Description copied from class:SoundStop playback of the current audio stream as soon as possible, and reset the sound position to its starting position, such that a subsequent call toSound.play()will cause the audio file to being playback from the beginning of the audio stream. -
setLooping
public void setLooping(boolean looping) Description copied from class:SoundSet whether audio stream playback should be looped indefinitely or not.- Overrides:
setLoopingin classSound- Parameters:
looping- true if the audio stream should be looped indefinitely
-
volume
public float volume() -
setVolume
public void setVolume(float volume) -
release
public void release()Description copied from class:SoundReleases resources used by this sound. It will no longer be usable after release. This will also happen automatically when this sound is garbage collected, but one may need to manually release sounds sooner to avoid running out of audio resources.
-