tecs.audio.timeline#

Overview#

functions

types

values

Functions#

newfunction#

function(
    clock: function(): number,
    options: Options?,
    player: (function(sound: any, options: any, at: number): integer)?
): Timeline

Creates a timeline over a clock.

The mixer makes these, through Audio.timeline, and runs their update from its own. A timeline made here directly has to be updated by its maker.

Arguments#

clock - function(): number
reads the audio clock in seconds
options - Options?
the tempo, bar length, lookahead and start, or nil
player - (function(sound: any, options: any, at: number): integer)?

Returns#

Timeline

the timeline, running unless options.paused

Raises#

Type Condition
string when the tempo is not positive and finite

Types#

Cuerecord#

record Cue

A handle on an event, to cancel it before it is sent.

Members#

instance methods

fields

settledfield#

settled: boolean

Read-only. Reports whether the event has gone to the backend, or been cancelled, so cancel would do nothing.

handlefield#

handle: integer

Read-only. The voice a play cue started once it was sent, zero before then and for a start the mixer refused.

cancelmethod#

function(exclusive self: Cue): boolean
Arguments#
exclusive self - Cue
Returns#
boolean

Optionstype#

type Options = {
    tempo: number?,
    beatsPerBar: integer?,
    lookahead: number?,
    start: number?,
    paused: boolean?
}

Configures a timeline.

Members#

tempofield#

tempo: number?

Caller-writable. Beats a minute, 60 by default, so a beat is a second.

beatsPerBarfield#

beatsPerBar: integer?

Caller-writable. Beats in a bar, four by default, for nextBar.

lookaheadfield#

lookahead: number?

Caller-writable. Seconds ahead events are sent, 0.05 by default.

startfield#

start: number?

Caller-writable. The beat the timeline starts at, zero by default.

pausedfield#

paused: boolean?

Caller-writable. Starts the timeline paused.

Timelinerecord#

record Timeline

Local time with a tempo and a pause, mapped onto the audio clock.

Members#

nowmethod#

function(borrows self: Timeline): number
Arguments#
borrows self - Timeline
Returns#
number

toClockmethod#

function(borrows self: Timeline, beat: number): number
Arguments#
borrows self - Timeline
beat - number
Returns#
number

fromClockmethod#

function(borrows self: Timeline, seconds: number): number
Arguments#
borrows self - Timeline
seconds - number
Returns#
number

tempomethod#

function(borrows self: Timeline): number
Arguments#
borrows self - Timeline
Returns#
number

setTempomethod#

function(exclusive self: Timeline, beatsPerMinute: number)
Arguments#
exclusive self - Timeline
beatsPerMinute - number

beatsPerBarmethod#

function(borrows self: Timeline): integer
Arguments#
borrows self - Timeline
Returns#
integer

nextBeatmethod#

function(borrows self: Timeline): number
Arguments#
borrows self - Timeline
Returns#
number

nextBarmethod#

function(borrows self: Timeline): number
Arguments#
borrows self - Timeline
Returns#
number

pausemethod#

function(exclusive self: Timeline)
Arguments#
exclusive self - Timeline

resumemethod#

function(exclusive self: Timeline)
Arguments#
exclusive self - Timeline

pausedmethod#

function(borrows self: Timeline): boolean
Arguments#
borrows self - Timeline
Returns#
boolean

seekmethod#

function(exclusive self: Timeline, beat: number)
Arguments#
exclusive self - Timeline
beat - number

followmethod#

function(exclusive self: Timeline, held: (function(): boolean)?)
Arguments#
exclusive self - Timeline
held - (function(): boolean)?

atmethod#

function(
    exclusive self: Timeline,
    beat: number,
    run: function(at: number): nil
): Cue
Arguments#
exclusive self - Timeline
beat - number
run - function(at: number): nil
Returns#
Cue

playmethod#

function(exclusive self: Timeline, sound: any, options: {[string]: any}?): Cue
Arguments#
exclusive self - Timeline
sound - any
options - {[string]: any}?
Returns#
Cue

pendingmethod#

function(borrows self: Timeline): integer
Arguments#
borrows self - Timeline
Returns#
integer

upcomingmethod#

function(borrows self: Timeline, limit: integer?): {number}
Arguments#
borrows self - Timeline
limit - integer?
Returns#
{number}

updatemethod#

function(exclusive self: Timeline): boolean
Arguments#
exclusive self - Timeline
Returns#
boolean

closemethod#

function(exclusive self: Timeline)
Arguments#
exclusive self - Timeline

closedStatemethod#

function(borrows self: Timeline): boolean
Arguments#
borrows self - Timeline
Returns#
boolean

Values#

LOOKAHEADvariable#

const LOOKAHEAD: number

Seconds of lookahead a timeline schedules by default.