Audio

Module: engine.audio

Audio manager. Instance automatically created at game.audio

Properties

_context AudioContext

(No description yet)

_mainGain GainNode

(No description yet)

_musicGain GainNode

(No description yet)

_pauseMusic Music

(No description yet)

_pauseSounds Array

(No description yet)

_soundGain GainNode

(No description yet)

formats Array

Current supported audio formats.

music Music

Current music.

muted Boolean (Default: false)

Is audio muted.

sounds Array

Currently playing sounds.

Methods

_decode(request, path, callback)

(No description yet)

Parameters:

  • request XMLHttpRequest
  • path String
  • callback Function
_error(path, callback)

(No description yet)

Parameters:

  • path String
  • callback Function
_load(path, callback)

(No description yet)

Parameters:

  • path String
  • callback Function
_loaded(path, callback, buffer)

(No description yet)

Parameters:

  • path String
  • callback Function
  • buffer AudioBuffer
_systemPause()

(No description yet)

_systemResume()

(No description yet)

clearCache() Static

Clear all audio buffers from cache.

mute()

Mute all audio.

playMusic(name) Music

(No description yet)

Parameters:

  • name String
playSound(name, [volume], [rate]) Sound

(No description yet)

Parameters:

  • name String
  • volume Number (optional)
  • rate Number (optional)
stopAll()

Stop all sounds.

stopMusic()

Stop current music.

toggle()

Toggle mute/unmute all audio.

unmute()

Unmute all audio.

Attributes

cache Object

Cache for audio buffers.

enabled Boolean (Default: true)

Is audio enabled.

formats Array

List of supported audio formats.

loopEnd Number (Default: 0)

Length to trim looped audio from end (seconds).

loopStart Number (Default: 0)

Length to trim looped audio from start (seconds).

musicVolume Number (Default: 1)

Initial music volume (0-1).

soundVolume Number (Default: 1)

Initial sound volume (0-1).

stopOnSceneChange Boolean (Default: true)

Stop all audio, when changing scene.