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:
  • $volumedouble - (optional)
  • $pitchdouble - (optional)
  • $pandouble - (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:
  • $volumedouble - (optional)
  • $pitchdouble - (optional)
  • $pandouble - (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:
  • $soundIdint - (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:
  • $soundIdint - (optional)
resume($soundId)
Parameters:
  • $soundIdint - (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:
  • $soundIdint
  • $loopingbool
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:
  • $soundIdint
  • $pitchfloat
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:
  • $soundIdint
  • $panfloat
  • $volumefloat
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:
  • $soundIdint
  • $priorityint - the priority (0 == lowest)
dispose()