Sound

Sound

Creates sounds.

Constructor

new Sound($parameters)

Description:
  • Creates a new sound.
Source:
Examples
// minimal
const sound = new Sound({

    $audio: audio
});
// full
const sound = new Sound({

    $audio: audio,
    $durationFadeOut: 1000 / 60,
    $loop: false,
    $radius: Number.POSITIVE_INFINITY,
    $stereo: true,
    $volume: 1
});
Parameters:
Name Type Attributes Description
$parameters object The given parameters.
$parameters.$audio string The audio source.
$parameters.$durationFadeOut number <optional>
The fade out duration (in ms) (must be positive).
$parameters.$loop boolean <optional>
The loop status.
$parameters.$radius number <optional>
The radius within which the sound is audible.
$parameters.$stereo boolean <optional>
The stereo status.
$parameters.$volume number <optional>
The volume.

Members

audio :string

Description:
  • Gets the audio source.
Source:
Gets the audio source.
Type:
  • string

durationFadeOut :number

Description:
  • Gets fade out duration (in ms) (must be positive).
Source:
Gets fade out duration (in ms) (must be positive).
Type:
  • number

loop :boolean

Description:
  • Gets the loop status.
Source:
Gets the loop status.
Type:
  • boolean

radius :number

Description:
  • Gets the radius within which the sound is audible.
Source:
Gets the radius within which the sound is audible.
Type:
  • number

stereo :boolean

Description:
  • Gets the stereo status.
Source:
Gets the stereo status.
Type:
  • boolean

volume :number

Description:
  • Gets the volume.
Source:
Gets the volume.
Type:
  • number