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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Configures this sound with an error in lieu of its platform implementation.boolean
Determine whether this audio stream is currently playing.boolean
play()
If possible, begin playback of this audio stream.boolean
prepare()
Prepares this sound to be played by preloading it into audio buffers.void
release()
Releases resources used by this sound.void
setLooping
(boolean looping) Set whether audio stream playback should be looped indefinitely or not.void
setVolume
(float volume) void
stop()
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.void
Configures this sound with its platform implementation.float
volume()
-
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:Sound
Prepares 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:Sound
Determine whether this audio stream is currently playing. -
play
public boolean play()Description copied from class:Sound
If 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:Sound
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. -
setLooping
public void setLooping(boolean looping) Description copied from class:Sound
Set whether audio stream playback should be looped indefinitely or not.- Overrides:
setLooping
in 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:Sound
Releases 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.
-