Class BaseContextAbstract

Emitter gives classes which extend it the ability to listen for and emit events. Inspiration and reference from Jerome Etienne's MicroEvent. MIT (c) 2011 Jerome Etienne.

Hierarchy (view full)

Implements

Constructors

Properties

debug: boolean = false

Set this debug flag to log all events that happen in this class.

isOffline: boolean = false
latencyHint: number | AudioContextLatencyCategory
lookAhead: number
name: string = "Emitter"
version: string = version

The version number semver

Accessors

  • get disposed(): boolean
  • Indicates if the instance was disposed. 'Disposing' an instance means that all of the Web Audio nodes that were created for the instance are disconnected and freed for garbage collection.

    Returns boolean

Methods

  • Parameters

    • _name: string
    • Optional _options: Partial<AudioWorkletNodeOptions>

    Returns AudioWorkletNode

  • Parameters

    • _numberOfChannels: number
    • _length: number
    • _sampleRate: number

    Returns AudioBuffer

  • Returns AudioBufferSourceNode

  • Parameters

    • Optional _numberOfInputs: number

    Returns ChannelMergerNode

  • Parameters

    • Optional _numberOfOutputs: number

    Returns ChannelSplitterNode

  • Returns ConstantSourceNode

  • Parameters

    • Optional _maxDelayTime: number

    Returns DelayNode

  • Returns DynamicsCompressorNode

  • Parameters

    • _feedForward: number[] | Float32Array
    • _feedback: number[] | Float32Array

    Returns IIRFilterNode

  • Parameters

    • _element: HTMLMediaElement

    Returns MediaElementAudioSourceNode

  • Parameters

    • _real: number[] | Float32Array
    • _imag: number[] | Float32Array
    • Optional _constraints: PeriodicWaveConstraints

    Returns PeriodicWave

  • Parameters

    • _audioData: ArrayBuffer

    Returns Promise<AudioBuffer>

  • Invoke all of the callbacks bound to the event with any arguments passed in.

    Parameters

    • event: "statechange" | "tick"

      The name of the event.

    • Rest ...args: any[]

      The arguments to pass to the functions listening.

    Returns this

  • Remove the event listener.

    Parameters

    • event: "statechange" | "tick"

      The event to stop listening to.

    • Optional callback: ((...args) => void)

      The callback which was bound to the event with Emitter.on. If no callback is given, all callbacks events are removed.

        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

  • Bind a callback to a specific event.

    Parameters

    • event: "statechange" | "tick"

      The name of the event to listen for.

    • callback: ((...args) => void)

      The callback to invoke when the event is emitted

        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

  • Bind a callback which is only invoked once

    Parameters

    • event: "statechange" | "tick"

      The name of the event to listen for.

    • callback: ((...args) => void)

      The callback to invoke when the event is emitted

        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

  • Parameters

    • _fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • _interval: number

    Returns number

  • Parameters

    • _fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • _timeout: number

    Returns number

  • Convert the class to a string

    Returns string

    Example

    const osc = new Tone.Oscillator();
    console.log(osc.toString());