SoundEffectPlayer
interface SoundEffectPlayer
SoundEffectPoolComponent |
Provides positional sound pool audio playback for an |
Provides playback control for instances of SoundEffect.
Summary
Public functions |
|
|---|---|
Unit |
Pauses a currently playing sound stream. |
Stream |
play(Plays a loaded sound effect. |
Unit |
Resumes a previously paused sound stream. |
Unit |
setLooping(stream: Stream, isLooping: Boolean)Updates the looping status of an active stream. |
Unit |
setVolume(stream: Stream, volume: @FloatRange(from = 0.0, to = 1.0) Float)Updates the volume of an active stream. |
Unit |
Stops a currently playing or paused sound stream and releases that stream ID. |
Public functions
pause
fun pause(stream: Stream): Unit
Pauses a currently playing sound stream.
If the stream has already been stopped or released due to hitting the max stream count then this method has no effect.
play
fun play(
soundEffect: SoundEffect,
volume: @FloatRange(from = 0.0, to = 1.0) Float,
priority: @IntRange(from = 0) Int,
isLooping: Boolean
): Stream
Plays a loaded sound effect.
The SoundEffects can play concurrently up to the max stream count of the SoundEffectPool from which they were loaded. If the max stream count is exceeded, streams with lower priority are stopped first.
| Parameters | |
|---|---|
soundEffect: SoundEffect |
the handle to the loaded |
volume: @FloatRange(from = 0.0, to = 1.0) Float |
volume in the range 0.0 to 1.0 |
priority: @IntRange(from = 0) Int |
playback priority (0 = lowest) |
isLooping: Boolean |
true to loop indefinitely, false to play once |
| Throws | |
|---|---|
RuntimeException |
if the sound effect fails to play |
resume
fun resume(stream: Stream): Unit
Resumes a previously paused sound stream.
If the stream has already been stopped or released due to hitting the max stream count then this method has no effect.
setLooping
fun setLooping(stream: Stream, isLooping: Boolean): Unit
Updates the looping status of an active stream.
If the stream has already been stopped or released due to hitting the max stream count then this method has no effect.
setVolume
fun setVolume(stream: Stream, volume: @FloatRange(from = 0.0, to = 1.0) Float): Unit
Updates the volume of an active stream.
If the stream has already been stopped or released due to hitting the max stream count then this method has no effect.
| Parameters | |
|---|---|
stream: Stream |
|
volume: @FloatRange(from = 0.0, to = 1.0) Float |
volume in the range 0.0 to 1.0 |
stop
fun stop(stream: Stream): Unit
Stops a currently playing or paused sound stream and releases that stream ID.
If the stream has already been stopped or released due to hitting the max stream count then this method has no effect.