Sound¶
-
php\gdx\audio\Sound
Class Sound
Methods
__construct
()¶private
play
($volume, $pitch, $pan)¶Plays the sound. If the sound is already playing, it will be played again, concurrently.
Parameters:
- $volume – double - (optional)
- $pitch – double - (optional)
- $pan – double - (optional)
Returns: int the id of the sound instance if successful, or -1 on failure.
loop
($volume, $pitch, $pan)¶Plays the sound, looping. If the sound is already playing, it will be played again, concurrently. You need to stop the sound via a call to stop(long) using the returned id.
Parameters:
- $volume – double - (optional)
- $pitch – double - (optional)
- $pan – double - (optional)
Returns: int the id of the sound instance if successful, or -1 on failure.
stop
($soundId)¶Stops playing all or $soundId instance(s) of this sound.
Parameters:
- $soundId – int - (optional)
pause
($soundId)¶Pauses the sound instance with the given id as returned by play() or all sounds. If the sound is no longer playing, this has no effect.
Parameters:
- $soundId – int - (optional)
resume
($soundId)¶
Parameters:
- $soundId – int - (optional)
setLooping
($soundId, $looping)¶Sets the sound instance with the given id to be looping. If the sound is no longer playing this has no effect
Parameters:
- $soundId – int
- $looping – bool
setPitch
($soundId, $pitch)¶Changes the pitch multiplier of the sound instance with the given id as returned by play(). If the sound is no longer playing, this has no effect.
Parameters:
- $soundId – int
- $pitch – float
setPan
($soundId, $pan, $volume)¶Sets the panning and volume of the sound instance with the given id as returned by play(). If the sound is no longer playing, this has no effect.
Parameters:
- $soundId – int
- $pan – float
- $volume – float
setPriority
($soundId, $priority)¶Sets the priority of a sound currently being played back. Higher priority sounds will be considered last if the maximum number of concurrently playing sounds is exceeded. This is only a hint and might not be honored by a backend implementation.
Parameters:
- $soundId – int
- $priority – int - the priority (0 == lowest)
dispose
()¶