Sound

Module: engine.audio
new game.Sound(id)

Parameters:

  • id String

    Audio asset id

Properties

_buffer AudioBuffer

(No description yet)

_context AudioContext

(No description yet)

_gainNode GainNode

(No description yet)

_rate Number

(No description yet)

_source AudioBufferSourceNode

(No description yet)

_volume Number

(No description yet)

loop Boolean (Default: false)

Is sound looping.

muted Boolean (Default: false)

Is sound muted.

onComplete Function

Function to call, when sound is completed.

paused Boolean (Default: false)

Is sound paused.

playing Boolean (Default: false)

Is sound playing.

rate Number (Default: 1)

Playback rate of audio (speed).

volume Number (Default: game.Audio.soundVolume)

Sound volume (0-1).

Methods

_fade(time, to)

(No description yet)

Parameters:

  • time Number
  • to Number
_onComplete()

(No description yet)

_onStart()

(No description yet)

fadeIn(time)

(No description yet)

Parameters:

  • time Number

    Time in milliseconds

fadeOut(time)

(No description yet)

Parameters:

  • time Number

    Time in milliseconds

mute()

(No description yet)

pause()

(No description yet)

play([when], [offset], [duration])

(No description yet)

Parameters:

  • when Number (optional)

    When to start playback in seconds, 0 is now

  • offset Number (optional)

    Offset of playback in seconds

  • duration Number (optional)

    Duration of playback in seconds

resume()

(No description yet)

stop([skipOnComplete])

(No description yet)

Parameters:

  • skipOnComplete Boolean (optional)

    Skip onComplete function

unmute()

(No description yet)