AudioHandler

AudioHandler

Manages playing of audio using Web Audio.

Constructor

new AudioHandler()

Source:

Classes

AudioHandler

Members

baseUrl :string

Source:
Type:
  • string

canPlay :boolean

Description:
  • If the manager can play a sound.
Source:
If the manager can play a sound.
Type:
  • boolean

Methods

createSfx(name)

Description:
  • Creates and returns an SFX.
Source:
Parameters:
Name Type Description
name string

load(src)

Description:
  • Load a sound into a sound manager
Source:
Parameters:
Name Type Description
src string

mute()

Description:
  • Sets the volume to zero.Sounds will continue playing but not be audible.
Source:

pauseAll()

Description:
  • Pauses currently playing sounds.
Source:

playBackgroundMusic(name)

Description:
  • Plays a single audio as the background in a loop throughout the game
Source:
Parameters:
Name Type Description
name string

playEffect(name, offsetopt, durationopt)

Description:
  • Plays a sound only once.
Source:
Parameters:
Name Type Attributes Default Description
name string Name of audio to play.
offset number <optional>
0 Where to start playing the audio.It is in seconds.
duration number <optional>
0 how long in seconds will the audio defaults to total duration of the selected audio.

remove(sfx)

Description:
  • Removes an sfx from the handler and disconnects it from its destination.
Source:
Parameters:
Name Type Description
sfx Sfx

unmute()

Description:
  • Restores the volume before it was muted.
Source: