|
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 |
loop(float volume,
float pitch,
float pan)
Plays the sound, looping. |
long |
play()
Plays the sound. |
long |
play(float volume)
Plays the sound. |
long |
play(float volume,
float pitch,
float pan)
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 |
setPriority(long soundId,
int priority)
Sets the priority of a sound currently being played back. |
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 play(float volume, float pitch, float pan)
volume
- the volume in the range [0,1]pitch
- the pitch multiplier, 1 == default, >1 == faster, <1 == slower, the value has to be between 0.5 and 2.0pan
- panning in the range -1 (full right) to 1 (full left). 0 is center position.
long loop()
long loop(float volume)
stop(long)
using the returned id.
volume
- the volume in the range [0, 1]
long loop(float volume, float pitch, float pan)
stop(long)
using the returned id.
volume
- the volume in the range [0,1]pitch
- the pitch multiplier, 1 == default, >1 == faster, <1 == slower, the value has to be between 0.5 and 2.0pan
- panning in the range -1 (full right) to 1 (full left). 0 is center position.
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 == slower, the value has to be between 0.5 and 2.0void 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].void setPriority(long soundId, int priority)
soundId
- the sound id as returned by play()
or loop()
and their overloaded equivalents.priority
- the priority (0 == lowest)
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |