Class Timeline<GenericEvent>

A Timeline class for scheduling and maintaining state along a timeline. All events must have a "time" property. Internally, events are stored in time order for fast retrieval.

Type Parameters

Hierarchy (view full)

Constructors

Properties

debug: boolean = false

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

increasing: boolean

If the time value must always be greater than or equal to the last element on the list.

memory: number

The memory of the timeline, i.e. how many events in the past it will retain

name: string = "Timeline"
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

  • Insert an event object onto the timeline. Events must have a "time" attribute.

    Parameters

    • event: GenericEvent

      The event object to insert into the timeline.

    Returns this

  • Cancel events at and after the given time

    Parameters

    • after: number

      The time to query.

    Returns this

  • Cancel events before or equal to the given time.

    Parameters

    • time: number

      The time to cancel before.

    Returns this

  • Iterate over everything in the array

    Parameters

    • callback: ((event) => void)

      The callback to invoke with every item

    Returns this

  • Iterate over everything in the array after the given time.

    Parameters

    • time: number

      The time to check if items are before

    • callback: ((event) => void)

      The callback to invoke with every item

    Returns this

  • Iterate over everything in the array at the given time

    Parameters

    • time: number

      The time to check if items are before

    • callback: ((event) => void)

      The callback to invoke with every item

    Returns this

  • Iterate over everything in the array at or before the given time.

    Parameters

    • time: number

      The time to check if items are before

    • callback: ((event) => void)

      The callback to invoke with every item

    Returns this

  • Iterate over everything in the array between the startTime and endTime. The timerange is inclusive of the startTime, but exclusive of the endTime. range = [startTime, endTime).

    Parameters

    • startTime: number

      The time to check if items are before

    • endTime: number

      The end of the test interval.

    • callback: ((event) => void)

      The callback to invoke with every item

    Returns this

  • Iterate over everything in the array at or after the given time. Similar to forEachAfter, but includes the item(s) at the given time.

    Parameters

    • time: number

      The time to check if items are before

    • callback: ((event) => void)

      The callback to invoke with every item

    Returns this

  • Convert the class to a string

    Returns string

    Example

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