Skip to content
Tone.js

OneShotSource

internal class ↳ extends ToneAudioNode<Options>

Base class for fire-and-forget nodes

new OneShotSource(options: OneShotSourceOptions)

Parameters

input: undefined

Sources do not have input nodes

The callback to invoke after the source is done playing.

Default: noOp

output: Gain

The public output node

read-only

Get the playback state at the current time

cancelStop(): this

Cancel a scheduled stop event

Returns this

dispose(): this

Dispose and disconnect

Returns this

getStateAtTime(time: Time): BasicPlaybackState

Get the playback state at the given time

Parameters

Returns BasicPlaybackState

stop(time?: Time): this

Stop the source node at the given time.

Parameters

  • time Time optional

    When to stop the source

Returns this

static

getDefaults(): OneShotSourceOptions

Returns all of the default options belonging to the class.

Returns OneShotSourceOptions