Class: WebAudioInstance

webaudio.WebAudioInstance

A single play instance that handles the AudioBufferSourceNode.

Extends

  • EventEmitter

Implements

Members

id number readonly

The current unique ID for this instance.

loop

If the sound instance should loop playback

muted

true if the sound is muted

paused boolean overrides

Pauses the sound.

progress number overrides

The current playback progress from 0 to 1.

speed

Set the instance speed from 0 to 1

volume

Get the set the volume for this instance from 0 to 1

Methods

_internalStop () void

Stops the instance.

_now () number

Get the current time in seconds.

Returns:
Type Description
number Seconds since start of context

_onComplete () void

Callback when completed.

_update (force) void

Internal update the progress.

Name Type Description
force

_updateListener ()

Callback for update listener

destroy () void

Don't use after this.

enableTicker (enabled) void

Start the update progress.

Name Type Description
enabled boolean

init (media) void

Initializes the instance.

Name Type Description
media webaudio.WebAudioMedia

play (options) void

Plays the sound.

Name Type Description
options Object

Play options

options.start number

The position to start playing, in seconds.

options.end number

The ending position in seconds.

options.speed number

Speed for the instance

options.loop boolean

If the instance is looping, defaults to sound loop

options.volume number

Volume of the instance

options.muted boolean

Muted state of instance

refresh () void

Refresh loop, volume and speed based on changes to parent

refreshPaused () void

Handle changes in paused state, either globally or sound or instance

set (name, value) this

Set a property by name, this makes it easy to chain values

Name Type Description
name string
  • Values include: 'speed', 'volume', 'muted', 'loop', 'paused'
value number | boolean
  • Value to set property to
Returns:
Type Description
this

stop () void overrides

Stops the instance, don't use after this.

toString () string

To string method for instance.

Returns:
Type Description
string The string representation of instance.

Inherited Events