A list of all sound effects currently being played. If a sound effect is not looping (which is likely typical), it will be removed from this list when it completes. This data structure allows us to pause all sound effects at the same time.
Used to give all playing sound effects unique ids.
Removes a sound from our list of currently-being-played sound effects.
The sound just removed.
Registers a sound for later playback.
The sound.
Returns the ID of the current music being played.
The current music's ID.
Initializes the audio system.
Returns whether the audio system initialized properly. This will return false if the user's browser does not support the web audio API.
Whether the sound system is initialized
Pauses all music and sound effects.
Plays a specific sound as background music. Only one "music" can play at a time, as opposed to "sounds," of which multiple can be playing at one time.
The ID of the resource to play as music. If this is
null
, the current music is stopped but no new music
is started.
Whether the music should loop.
Plays the sound with the given ID.
The ID of the resource to play.
Whether the music should loop. Defaults to
false
.
An optional callback to call when the
sound completes. This callback will receive the returned numeric
ID as a parameter. This parameter is ignored if loop
is true
.
An ID for the playing sound. This can be used to
stop a looping sound via stopSound(id)
.
Resumes all music and sound effects.
Stops the currently playing music, if any.
If true
, the music is only paused;
otherwise, native resources are freed and the music cannot be
resumed.
Stops a playing sound, by ID.
The sound effect to stop.
Whether the sound effect was stopped. This will be
false
if the sound effect specified is no longer
playing.
Generated using TypeDoc
A wrapper around web audio for games.