Class SoundEffect
java.lang.Object
com.codename1.gaming.SoundEffect
A short, reusable sound clip loaded into a SoundPool.
Obtain one with SoundPool#load(String) or SoundPool#load(java.io.InputStream, String),
then play it any number of times -- overlapping plays mix together up to the
pool's voice limit. A sound effect belongs to the pool that created it and must
not be used with a different pool.
-
Method Summary
Modifier and TypeMethodDescriptiongetPool()The pool that owns this effect.booleanisLoaded()True until#unload()is called.intplay()Plays the effect once at full volume, returning a voice id or -1 if the pool is exhausted.intplay(float volume, float pan, float rate, int loop) Plays the effect with explicit parameters.voidunload()Releases this effect's buffers from the pool.
-
Method Details
-
getPool
The pool that owns this effect. -
isLoaded
public boolean isLoaded()True until#unload()is called. -
play
public int play()Plays the effect once at full volume, returning a voice id or -1 if the pool is exhausted. Equivalent topool.play(this). -
play
public int play(float volume, float pan, float rate, int loop) Plays the effect with explicit parameters. SeeSoundPool#play(SoundEffect, float, float, float, int). -
unload
public void unload()Releases this effect's buffers from the pool. The effect must not be played afterwards.
-