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 all sounds and music muted.

mutedMusic Boolean (Default: false)

Is music muted.

mutedSound Boolean (Default: false)

Is all sounds 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 sounds and music.

muteMusic()

Mute music.

muteMusic()

Unmute music.

muteSound()

Unmute all sounds.

muteSound()

Mute all sounds.

playMusic(name, [noLoop]) Music

(No description yet)

Parameters:

  • name String
  • noLoop Boolean (optional)

    Do not loop the music

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.