SoundEffectPlayer
public interface SoundEffectPlayer
SoundEffectPoolComponent |
Provides positional sound pool audio playback for an |
Provides playback control for instances of SoundEffect.
Summary
Public methods |
|
|---|---|
abstract void |
Pauses a currently playing sound stream. |
abstract @NonNull Stream |
play(Plays a loaded sound effect. |
abstract void |
Resumes a previously paused sound stream. |
abstract void |
setLooping(@NonNull Stream stream, boolean isLooping)Updates the looping status of an active stream. |
abstract void |
setVolume(Updates the volume of an active stream. |
abstract void |
Stops a currently playing or paused sound stream and releases that stream ID. |
Public methods
pause
abstract void pause(@NonNull Stream stream)
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
abstract @NonNull Stream play(
@NonNull SoundEffect soundEffect,
@FloatRange(from = 0.0, to = 1.0) float volume,
@IntRange(from = 0) int priority,
boolean isLooping
)
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 | |
|---|---|
@NonNull SoundEffect soundEffect |
the handle to the loaded |
@FloatRange(from = 0.0, to = 1.0) float volume |
volume in the range 0.0 to 1.0 |
@IntRange(from = 0) int priority |
playback priority (0 = lowest) |
boolean isLooping |
true to loop indefinitely, false to play once |
| Throws | |
|---|---|
RuntimeException |
if the sound effect fails to play |
resume
abstract void resume(@NonNull Stream stream)
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
abstract void setLooping(@NonNull Stream stream, boolean isLooping)
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
abstract void setVolume(
@NonNull Stream stream,
@FloatRange(from = 0.0, to = 1.0) float volume
)
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 | |
|---|---|
@NonNull Stream stream |
|
@FloatRange(from = 0.0, to = 1.0) float volume |
volume in the range 0.0 to 1.0 |
stop
abstract void stop(@NonNull Stream stream)
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.