Sfx

Sfx

This class is responsible for playing a singular sound.

Constructor

new Sfx(handler, buffer)

Source:
Parameters:
Name Type Description
handler AudioHandler
buffer AudioBuffer

Classes

Sfx

Members

duration :number

Description:
  • how long to play the sound.
Source:
how long to play the sound.
Type:
  • number

loop :boolean

Description:
  • Whether to start from the beginning after sound has finished playing.
Source:
Whether to start from the beginning after sound has finished playing.
Type:
  • boolean

offset :number

Description:
  • Time on the sound to begin playing
Source:
Time on the sound to begin playing
Type:
  • number

onended

Description:
  • Set callback when the sound finishes playing.
Source:
Set callback when the sound finishes playing.

Methods

connect(node)

Description:
  • Sets the given audionode to be the output destination of an sfx
Source:
Parameters:
Name Type Description
node AudioNode

disconnect()

Description:
  • Disconnects this sfx from its current destination.
Source:

pause()

Description:
  • Halts playing of an sfx.
Source:

play()

Description:
  • Plays an sfx from the beginning.
Source:

resume()

Description:
  • Continues playing an sfx from where it was paused.
Source: