|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Sound
A Sound is a short audio clip that can be played numerous times in parallel. It's completely loaded into memory so only load
small audio files. Call the dispose()
method when you're done using the Sound.
Sound instances are created via a call to Audio.newSound(FileHandle)
.
Calling the play()
or play(float)
method will return a long which is an id to that instance of the sound. You
can use this id to modify the playback of that sound instance.
Method Summary | |
---|---|
void |
dispose()
Releases all the resources. |
long |
loop()
Plays the sound, looping. |
long |
loop(float volume)
Plays the sound, looping. |
long |
play()
Plays the sound. |
long |
play(float volume)
Plays the sound. |
void |
setLooping(long soundId,
boolean looping)
Sets the sound instance with the given id to be looping. |
void |
setPan(long soundId,
float pan,
float volume)
Sets the panning and volume of the sound instance with the given id as returned by play() or play(float) . |
void |
setPitch(long soundId,
float pitch)
Changes the pitch multiplier of the sound instance with the given id as returned by play() or play(float) . |
void |
setVolume(long soundId,
float volume)
Changes the volume of the sound instance with the given id as returned by play() or play(float) . |
void |
stop()
Stops playing all instances of this sound. |
void |
stop(long soundId)
Stops the sound instance with the given id as returned by play() or play(float) . |
Method Detail |
---|
long play()
long play(float volume)
volume
- the volume in the range [0,1]
long loop()
long loop(float volume)
volume
- the volume in the range [0, 1]
void stop()
void dispose()
dispose
in interface Disposable
void stop(long soundId)
play()
or play(float)
. If the sound is no longer
playing, this has no effect.
soundId
- the sound idvoid setLooping(long soundId, boolean looping)
soundId
- the sound idlooping
- whether to loop or not.void setPitch(long soundId, float pitch)
play()
or play(float)
.
If the sound is no longer playing, this has no effect.
soundId
- the sound idpitch
- the pitch multiplier, 1 == default, >1 == faster, <1 == slowervoid setVolume(long soundId, float volume)
play()
or play(float)
. If the
sound is no longer playing, this has no effect.
soundId
- the sound idvolume
- the volume in the range 0 (silent) to 1 (max volume).void setPan(long soundId, float pan, float volume)
play()
or play(float)
.
If the sound is no longer playing, this has no effect.
soundId
- the sound idpan
- panning in the range -1 (full right) to 1 (full left). 0 is center position.volume
- the volume in the range [0,1].
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |