- All Superinterfaces:
Asset
AudioClip defines the api for audio
Assets.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFinishListener(Consumer<AudioClip> callback) Called when an AudioClip completes playing.voiddispose()Frees up any system resources being used.floatbooleandefault voidloop()Continues playing the AudioClip until pause or stop is called.voidloop(int times) Continues playing the AudioClip for a number of times or until pause or stop is called.voidpause()Pauses playback.voidplay()Begins or resumes playback.voidsetVolume(float volume) Sets the volume where 0 is silent and 1 is full volume.voidstop()Stops audio playback.
-
Field Details
-
CONTINUOUS_LOOPING
static final int CONTINUOUS_LOOPING- See Also:
-
-
Method Details
-
isPlaying
boolean isPlaying()- Returns:
- True if currently playing audio
-
play
void play()Begins or resumes playback. -
pause
void pause()Pauses playback. AudioClip will resume where it was paused when play is called next. -
stop
void stop()Stops audio playback. AudioClip will start from the beginning when play is called next. -
loop
default void loop()Continues playing the AudioClip until pause or stop is called. -
loop
void loop(int times) Continues playing the AudioClip for a number of times or until pause or stop is called. If times is set toCONTINUOUS_LOOPINGit will play until pause or stop is called.- Parameters:
times- how many times the AudioClip should loop
-
getVolume
float getVolume()- Returns:
- volume where 0 is silent and 1 is full volume
-
setVolume
void setVolume(float volume) Sets the volume where 0 is silent and 1 is full volume.- Parameters:
volume- the new volume
-
dispose
void dispose()Frees up any system resources being used. -
addFinishListener
Called when an AudioClip completes playing.- Parameters:
callback-Consumerthat provides the AudioClip that finished
-