@msb235/blits 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +154 -0
- package/README.md +3 -3
- package/dist/ahead.d.ts +26 -0
- package/dist/ahead.js +264 -0
- package/dist/around.d.ts +11 -0
- package/dist/around.js +32 -0
- package/dist/bare.js +15 -7
- package/dist/blank.d.ts +10 -0
- package/dist/blank.js +26 -0
- package/dist/blend.d.ts +2 -1
- package/dist/blend.js +1 -6
- package/dist/bound.d.ts +70 -0
- package/dist/bound.js +351 -0
- package/dist/chain.d.ts +2 -1
- package/dist/chain.js +7 -5
- package/dist/changes.d.ts +24 -0
- package/dist/changes.js +189 -0
- package/dist/channels.d.ts +39 -13
- package/dist/channels.js +14 -5
- package/dist/color.d.ts +12 -10
- package/dist/color.js +25 -25
- package/dist/columns.js +7 -3
- package/dist/contribution.d.ts +30 -0
- package/dist/contribution.js +374 -0
- package/dist/copyout.d.ts +10 -0
- package/dist/copyout.js +69 -24
- package/dist/crowd.d.ts +8 -2
- package/dist/crowd.js +4 -5
- package/dist/cue.d.ts +8 -1
- package/dist/cue.js +39 -13
- package/dist/cut.d.ts +8 -0
- package/dist/cut.js +4 -0
- package/dist/drop.d.ts +9 -0
- package/dist/drop.js +84 -0
- package/dist/due.d.ts +24 -5
- package/dist/due.js +113 -33
- package/dist/easing.d.ts +4 -4
- package/dist/easing.js +3 -3
- package/dist/everyone.d.ts +3 -2
- package/dist/everyone.js +3 -3
- package/dist/fade.d.ts +2 -1
- package/dist/fade.js +2 -1
- package/dist/fill.d.ts +3 -2
- package/dist/fill.js +51 -19
- package/dist/fit.d.ts +44 -26
- package/dist/fit.js +10 -9
- package/dist/fold.d.ts +4 -37
- package/dist/fold.js +5 -513
- package/dist/gather.d.ts +12 -7
- package/dist/gather.js +179 -44
- package/dist/gone.js +2 -2
- package/dist/grid.d.ts +47 -0
- package/dist/grid.js +247 -0
- package/dist/handle.d.ts +2 -0
- package/dist/handle.js +14 -8
- package/dist/held.d.ts +2 -1
- package/dist/history.d.ts +6 -5
- package/dist/history.js +7 -9
- package/dist/hosts.js +9 -15
- package/dist/index.d.ts +5 -4
- package/dist/keyfill.d.ts +1 -1
- package/dist/keyfill.js +5 -3
- package/dist/keyrows.d.ts +12 -0
- package/dist/keyrows.js +99 -12
- package/dist/lane.d.ts +36 -6
- package/dist/lane.js +32 -1
- package/dist/lanes.d.ts +23 -8
- package/dist/lanes.js +29 -8
- package/dist/leavings.d.ts +2 -2
- package/dist/leavings.js +1 -1
- package/dist/lives.d.ts +47 -0
- package/dist/lives.js +180 -0
- package/dist/meet.d.ts +2 -2
- package/dist/meet.js +90 -4
- package/dist/mixer.d.ts +54 -36
- package/dist/mixer.js +53 -171
- package/dist/motion.d.ts +14 -118
- package/dist/motion.js +16 -8
- package/dist/motions.d.ts +62 -155
- package/dist/motions.js +56 -370
- package/dist/moved.d.ts +1 -1
- package/dist/moved.js +16 -7
- package/dist/named.d.ts +0 -1
- package/dist/named.js +20 -2
- package/dist/numbers.d.ts +2 -0
- package/dist/numbers.js +4 -0
- package/dist/owed.d.ts +2 -0
- package/dist/owed.js +4 -0
- package/dist/pack.d.ts +2 -1
- package/dist/pack.js +2 -3
- package/dist/patch.d.ts +7 -3
- package/dist/patch.js +6 -2
- package/dist/places.d.ts +53 -0
- package/dist/places.js +171 -0
- package/dist/plot.d.ts +12 -0
- package/dist/plot.js +52 -0
- package/dist/project.d.ts +4 -4
- package/dist/project.js +9 -212
- package/dist/pull.js +11 -8
- package/dist/qualify.js +84 -21
- package/dist/reading.d.ts +6 -0
- package/dist/reading.js +5 -0
- package/dist/record.d.ts +5 -1
- package/dist/record.js +3 -2
- package/dist/relink.d.ts +1 -1
- package/dist/restored.d.ts +2 -2
- package/dist/restored.js +1 -1
- package/dist/rests.d.ts +9 -0
- package/dist/rests.js +76 -0
- package/dist/revive.d.ts +3 -2
- package/dist/revive.js +2 -2
- package/dist/{locus.d.ts → role.d.ts} +10 -9
- package/dist/{locus.js → role.js} +3 -3
- package/dist/roles.d.ts +10 -0
- package/dist/roles.js +158 -0
- package/dist/roster.js +3 -3
- package/dist/rotation.d.ts +1 -1
- package/dist/rotation.js +1 -1
- package/dist/rows.js +1 -1
- package/dist/sample.d.ts +2 -2
- package/dist/sample.js +33 -7
- package/dist/seek.js +5 -5
- package/dist/setting.d.ts +27 -0
- package/dist/setting.js +55 -0
- package/dist/shared.d.ts +1 -1
- package/dist/shared.js +1 -1
- package/dist/signals.d.ts +64 -32
- package/dist/signals.js +20 -18
- package/dist/stack.d.ts +5 -5
- package/dist/stack.js +5 -5
- package/dist/standing.d.ts +2 -1
- package/dist/standing.js +3 -2
- package/dist/store.d.ts +9 -0
- package/dist/store.js +24 -0
- package/dist/strays.d.ts +2 -1
- package/dist/strays.js +20 -13
- package/dist/stretch.d.ts +112 -0
- package/dist/stretch.js +9 -0
- package/dist/subject.d.ts +142 -0
- package/dist/subject.js +1 -0
- package/dist/tape.d.ts +9 -5
- package/dist/tape.js +5 -1
- package/dist/then.d.ts +9 -0
- package/dist/then.js +57 -0
- package/dist/ticker.d.ts +4 -4
- package/dist/transport.d.ts +0 -8
- package/dist/transport.js +0 -4
- package/dist/turns.d.ts +4 -3
- package/dist/turns.js +4 -3
- package/dist/types/arc.d.ts +12 -11
- package/dist/types/channel.d.ts +12 -8
- package/dist/types/history.d.ts +35 -19
- package/dist/types/mix.d.ts +222 -163
- package/dist/types/motion.d.ts +151 -0
- package/dist/types/motion.js +1 -0
- package/dist/types/patch.d.ts +67 -34
- package/dist/types/place.d.ts +51 -36
- package/dist/types/transport.d.ts +20 -18
- package/dist/types/voice.d.ts +136 -70
- package/dist/types/watch.d.ts +88 -40
- package/dist/types.d.ts +1 -0
- package/dist/voice.d.ts +7 -143
- package/dist/voice.js +28 -79
- package/dist/warn.d.ts +2 -0
- package/dist/warn.js +1 -1
- package/dist/watch.d.ts +2 -2
- package/dist/watch.js +5 -3
- package/dist/wave.d.ts +4 -3
- package/dist/wave.js +3 -2
- package/dist/weigh.d.ts +7 -1
- package/dist/weigh.js +27 -0
- package/docs/schema.html +212 -34
- package/package.json +2 -2
package/dist/types/mix.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type { ArcHandle, ArcSpec } from './arc.js';
|
|
2
2
|
import type { Kit } from './channel.js';
|
|
3
3
|
import type { HistoryOptions, Tape } from './history.js';
|
|
4
|
-
import type { Patch, Sent, Signal } from './patch.js';
|
|
4
|
+
import type { Band, Easing, Patch, Sent, Signal } from './patch.js';
|
|
5
5
|
import type { Booker, BookOptions, Marked } from './place.js';
|
|
6
6
|
import type { Transport } from './transport.js';
|
|
7
|
-
import type { BlendMember, Handle, OwnerSpec, SpanHandle, SpanSpec, VoiceSpec } from './voice.js';
|
|
7
|
+
import type { BlendMember, Circle, Handle, OwnerSpec, SpanHandle, SpanSpec, VoiceSpec } from './voice.js';
|
|
8
8
|
/**
|
|
9
|
-
* How a mix is built
|
|
9
|
+
* How a mix is built. It names the engine, reduced motion, the host, and the mix's limits.
|
|
10
10
|
*
|
|
11
11
|
* @category mix
|
|
12
12
|
*/
|
|
13
13
|
export interface MixOptions<H = unknown> {
|
|
14
14
|
engine?: Engine;
|
|
15
|
-
/**
|
|
15
|
+
/** Whether motion is reduced. Fades and warm-ups then snap, and `dt` reads Infinity. */
|
|
16
16
|
reduce?: boolean | (() => boolean);
|
|
17
17
|
/** Merged into every `setting.host`. Its type is the mix's `H`, which every patch and signal it cues reads. */
|
|
18
18
|
host?: H;
|
|
@@ -20,14 +20,13 @@ export interface MixOptions<H = unknown> {
|
|
|
20
20
|
* The band a rest-less channel's contribution switches on and off across. Default: on at any weight
|
|
21
21
|
* above 0, off at 0, so the contribution passes whole while its voice has any weight.
|
|
22
22
|
*/
|
|
23
|
-
band?:
|
|
24
|
-
on: number;
|
|
25
|
-
off: number;
|
|
26
|
-
};
|
|
23
|
+
band?: Band;
|
|
27
24
|
/**
|
|
28
|
-
* Tags that act as
|
|
29
|
-
* named that tag.
|
|
25
|
+
* Tags that act as roles. A voice carrying one folds with the others carrying it, as if its
|
|
26
|
+
* `role` named that tag.
|
|
30
27
|
*/
|
|
28
|
+
roles?: readonly string[];
|
|
29
|
+
/** @deprecated Renamed `roles`. Taken as `roles`, with a warning outside production. */
|
|
31
30
|
loci?: readonly string[];
|
|
32
31
|
/**
|
|
33
32
|
* The most `dt` a `step` or signal is handed, however long the gap. Off by default, since a
|
|
@@ -35,48 +34,49 @@ export interface MixOptions<H = unknown> {
|
|
|
35
34
|
*/
|
|
36
35
|
maxDt?: number;
|
|
37
36
|
/**
|
|
38
|
-
*
|
|
39
|
-
* patches play the same at any frame rate. Intervals count from when a
|
|
40
|
-
* the remainder carrying to the next sample; `maxDt` then caps how many
|
|
41
|
-
* Signals and `at` still see the frame. Off by default.
|
|
37
|
+
* A fixed interval, ms, to run every `step` at. Without it each `step` runs once by the frame's
|
|
38
|
+
* gap; with it stateful patches play the same at any frame rate. Intervals count from when a
|
|
39
|
+
* subject's delay ran out, the remainder carrying to the next sample; `maxDt` then caps how many
|
|
40
|
+
* one sample may run. Signals and `at` still see the frame. Off by default.
|
|
42
41
|
*/
|
|
43
42
|
stepMs?: number;
|
|
44
43
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
44
|
+
* What the mix remembers so `project` and `seek` can read back. `ms` is how far back `project`
|
|
45
|
+
* may read, in ms of mix time, and `every` how often a stateful voice's state is kept per subject
|
|
46
|
+
* on the way, in ms (default 200). Within it the mix remembers what it cued, every change a
|
|
47
|
+
* handle made and when, the voices that have left, and those copies of state, so a read back
|
|
48
|
+
* restores the nearest copy and steps forward from it. Off by default, and a mix without it keeps
|
|
49
|
+
* nothing. With `inputs`, it also keeps what each input signal on a voice's weight read per
|
|
50
|
+
* subject, and the host fields patches `reads`, each time they changed, so a read back over a
|
|
51
51
|
* `level` or a pointer is known rather than held. With `tape`, the mix also records every call
|
|
52
52
|
* the host makes on it, its handles and its motion patches, so `seek` can move it and play those
|
|
53
53
|
* calls again.
|
|
54
54
|
*/
|
|
55
55
|
history?: HistoryOptions;
|
|
56
56
|
/**
|
|
57
|
-
* A subject's key, for a history `store
|
|
58
|
-
* string or number subject is its own key; with a store, an object subject needs this.
|
|
57
|
+
* A subject's key, for a history `store`. It is unique among this mix's subjects for the session.
|
|
58
|
+
* A string or number subject is its own key; with a store, an object subject needs this.
|
|
59
59
|
*/
|
|
60
60
|
keyOf?(subject: never): string | number;
|
|
61
61
|
/**
|
|
62
|
-
* What a debugger calls a subject (see `watched`)
|
|
63
|
-
* `name` or `id`, a DOM element's tag, id and classes, or its class and a number.
|
|
62
|
+
* What a debugger calls a subject (see `watched`). Where it gives nothing, the debugger uses the
|
|
63
|
+
* subject's own `name` or `id`, a DOM element's tag, id and classes, or its class and a number.
|
|
64
64
|
*/
|
|
65
65
|
labelOf?(subject: never): string | undefined;
|
|
66
66
|
/**
|
|
67
|
-
* Whether a channel may run as a lane
|
|
68
|
-
* every voice writing
|
|
69
|
-
* way (`probe`, `pull`, `atRest`, `weightOf`, `inert` and `project`), so turning it off is
|
|
70
|
-
* ruling a lane out, or for comparing against. A voice weighted by an input signal `input`
|
|
71
|
-
* make, or whose patch reads host fields, never runs on a lane, since a change to either
|
|
72
|
-
* between two probes would not reach it. Two things differ: a
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
67
|
+
* Whether a channel may run as a lane. A lane computes every subject at once in flat arrays, when
|
|
68
|
+
* every voice writing the channel can run that way. On by default; what a host reads is the same
|
|
69
|
+
* either way (`probe`, `pull`, `atRest`, `weightOf`, `inert` and `project`), so turning it off is
|
|
70
|
+
* for ruling a lane out, or for comparing against. A voice weighted by an input signal `input`
|
|
71
|
+
* did not make, or whose patch reads host fields, never runs on a lane, since a change to either
|
|
72
|
+
* between two probes would not reach it. Two things differ: a stateless patch's `setting.send`
|
|
73
|
+
* from `at` sends for every subject a lane fills, those probed this frame or the last, and a
|
|
74
|
+
* patch that first calls `setting.keep` partway through playing can advance that state once more
|
|
75
|
+
* for one subject probed the frame before (see `Setting.keep`).
|
|
76
76
|
*/
|
|
77
77
|
lanes?: boolean;
|
|
78
78
|
/**
|
|
79
|
-
* The transport this mix plays on, shared with other mixes
|
|
79
|
+
* The transport this mix plays on, shared with other mixes. They then keep one clock, and a query
|
|
80
80
|
* naming a score looks in all of them. The transport's `sync`, `rebase`, `rate`, `ramp` and
|
|
81
81
|
* `seek` move it, and the mix's own throw. Its history is the transport's, so the mix takes no
|
|
82
82
|
* `history` of its own.
|
|
@@ -86,17 +86,17 @@ export interface MixOptions<H = unknown> {
|
|
|
86
86
|
name?: string;
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
|
-
* How sure a projection is of one channel
|
|
90
|
-
* it; `stepped` where state was advanced across a gap in one go, which is as good as the
|
|
91
|
-
* step makes it, or a signal's state was read back from a copy; `held` where it depends on
|
|
92
|
-
* is not known, so the value it had is held.
|
|
89
|
+
* How sure a projection is of one channel. It is `exact` where only the clock and known changes
|
|
90
|
+
* drove it; `stepped` where state was advanced across a gap in one go, which is as good as the
|
|
91
|
+
* patch's step makes it, or a signal's state was read back from a copy; `held` where it depends on
|
|
92
|
+
* input from outside the clock, whose value at that time is not known, so the value it had is held.
|
|
93
93
|
*
|
|
94
94
|
* @category mix
|
|
95
95
|
*/
|
|
96
96
|
export type Doubt = 'exact' | 'stepped' | 'held';
|
|
97
97
|
/**
|
|
98
|
-
* The mix read at another time
|
|
99
|
-
*
|
|
98
|
+
* The mix read at another time, with nothing in the live mix moved. It gives what `probe` would
|
|
99
|
+
* give at that timestamp. Valid until the mix is next synced or cued.
|
|
100
100
|
*
|
|
101
101
|
* @category mix
|
|
102
102
|
*/
|
|
@@ -105,14 +105,14 @@ export interface Projection<I, O> {
|
|
|
105
105
|
readonly timestamp: number;
|
|
106
106
|
/** The merged pose for one subject at this projection's timestamp. */
|
|
107
107
|
probe(subject: I, out?: O): O;
|
|
108
|
-
/**
|
|
108
|
+
/** How sure that pose is, per channel. The least sure voice that fed a channel decides. */
|
|
109
109
|
assess(subject: I): {
|
|
110
110
|
[K in keyof O]-?: Doubt;
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
|
-
* Arrays for `pull` to write, one per channel it reads
|
|
115
|
-
* array of numbers.
|
|
114
|
+
* Arrays for `pull` to write, one per channel it reads. It reads any channel whose value is a
|
|
115
|
+
* number or an array of numbers.
|
|
116
116
|
*
|
|
117
117
|
* @category mix
|
|
118
118
|
*/
|
|
@@ -128,45 +128,45 @@ export interface Mix<I, O, H = unknown> {
|
|
|
128
128
|
/** Cues a voice. Throws when the engine cannot run the patch's form, or the kit lacks a channel. */
|
|
129
129
|
cue(spec: VoiceSpec<I, O, H>): Handle<I>;
|
|
130
130
|
/**
|
|
131
|
-
* N voices
|
|
132
|
-
* signal is read once per subject per frame, with the first member's setting, and every
|
|
133
|
-
* takes its share of that one reading, which `share` reads outside the blend; a signal
|
|
134
|
-
* state keeps it once, not per member. One `spec` cues them all, and a member given as a
|
|
131
|
+
* Cues N voices into one role, their weights split from one signal. They fold as alternatives.
|
|
132
|
+
* The signal is read once per subject per frame, with the first member's setting, and every
|
|
133
|
+
* member takes its share of that one reading, which `share` reads outside the blend; a signal
|
|
134
|
+
* keeping state keeps it once, not per member. One `spec` cues them all, and a member given as a
|
|
135
135
|
* `BlendMember` carries its own `name`, `tags` and `hits` in place of the spec's.
|
|
136
136
|
*/
|
|
137
|
-
blend(members: readonly (Patch<I, O, any, H> | BlendMember<I, O, H>)[], by: Signal<I, H>, spec?: Omit<VoiceSpec<I, O, H>, 'patch' | 'weight' | 'locus'>): Handle<I>[];
|
|
137
|
+
blend(members: readonly (Patch<I, O, any, H> | BlendMember<I, O, H>)[], by: Signal<I, H>, spec?: Omit<VoiceSpec<I, O, H>, 'patch' | 'weight' | 'role' | 'locus' | 'within'>): Handle<I>[];
|
|
138
138
|
/**
|
|
139
|
-
* Cues an owner
|
|
140
|
-
*
|
|
141
|
-
* on all of them: `rate` and `ramp` multiply into theirs, `seek` moves their clocks
|
|
142
|
-
* and rebuilds their state as it does a voice's, and `weight` and `fade()` multiply
|
|
143
|
-
* what its `weightOf` reports; it fades as a whole, not by subject or at
|
|
144
|
-
* `played` once every voice it held has finished its passes, and leaves, `done`, with
|
|
145
|
-
* fade that ends takes the rest with it. One that never holds a voice stays until
|
|
146
|
-
* nest. Throws for a `loop`: a pass would have to restart its children.
|
|
139
|
+
* Cues an owner, a voice with no patch that plays other voices on its own clock. It holds the
|
|
140
|
+
* voices cued with `owner` set to its handle, so they can be placed, timed and faded as one. Its
|
|
141
|
+
* handle acts on all of them: `rate` and `ramp` multiply into theirs, `seek` moves their clocks
|
|
142
|
+
* with its own and rebuilds their state as it does a voice's, and `weight` and `fade()` multiply
|
|
143
|
+
* into their weights, by what its `weightOf` reports; it fades as a whole, not by subject or at
|
|
144
|
+
* rest. It is `played` once every voice it held has finished its passes, and leaves, `done`, with
|
|
145
|
+
* its last; a fade that ends takes the rest with it. One that never holds a voice stays until
|
|
146
|
+
* faded. Owners nest. Throws for a `loop`: a pass would have to restart its children.
|
|
147
147
|
*/
|
|
148
148
|
owns(spec: OwnerSpec<I, H>): Handle<I>;
|
|
149
149
|
/**
|
|
150
|
-
* Cues a span
|
|
151
|
-
* `
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
150
|
+
* Cues a span, an owner that fits the voices it holds into its `duration`. It lays them out in
|
|
151
|
+
* `order`, again each time one joins or leaves early. A child's start and rate are the span's to
|
|
152
|
+
* set, so it takes neither `start` nor an anchored start; its `SpanHints` say how it may give
|
|
153
|
+
* way. A span with a budget stays until the budget has passed, though its children finish sooner,
|
|
154
|
+
* so late ones can still join, and its `end` mark is where its children end or its budget does,
|
|
155
|
+
* whichever is later. A voice that loops for good cannot join one. Throws for a `rate` below 0: a
|
|
156
|
+
* span lays its children out forward from its start, and its handle's `rate` turns it once it
|
|
157
|
+
* plays.
|
|
158
158
|
*/
|
|
159
159
|
span(spec: SpanSpec<I, H>): SpanHandle<I>;
|
|
160
160
|
/**
|
|
161
|
-
* Cues an arc
|
|
162
|
-
* `active` for the `hold`, then `exit`, each a voice or several layered. Its marks are its
|
|
163
|
-
* `start` as the enter begins, `in` as it ends, `coast` as the hold ends and `out` as the
|
|
164
|
-
* begins, which are one time, and `end` as the exit ends, where it leaves and `done`
|
|
165
|
-
* While the hold is open, `coast`, `out` and `end` are unknown until `release` fixes
|
|
166
|
-
* part shows its first and last frames through the blends either side of it, and a
|
|
167
|
-
* out leaves its time to the one before it. Its `fade` takes it out with no exit. An
|
|
168
|
-
* finite hold may sit in a span. Throws for a `rate` below 0, a hold below 0, and an
|
|
169
|
-
* `exit` that never ends.
|
|
161
|
+
* Cues an arc, an owner holding three parts that hand over in order. On its clock `enter` plays,
|
|
162
|
+
* then `active` for the `hold`, then `exit`, each a voice or several layered. Its marks are its
|
|
163
|
+
* own: `start` as the enter begins, `in` as it ends, `coast` as the hold ends and `out` as the
|
|
164
|
+
* exit begins, which are one time, and `end` as the exit ends, where it leaves and `done`
|
|
165
|
+
* resolves. While the hold is open, `coast`, `out` and `end` are unknown until `release` fixes
|
|
166
|
+
* them. Each part shows its first and last frames through the blends either side of it, and a
|
|
167
|
+
* part left out leaves its time to the one before it. Its `fade` takes it out with no exit. An
|
|
168
|
+
* arc with a finite hold may sit in a span. Throws for a `rate` below 0, a hold below 0, and an
|
|
169
|
+
* `enter` or `exit` that never ends.
|
|
170
170
|
*/
|
|
171
171
|
arc(spec: ArcSpec<I, O, H>): ArcHandle<I>;
|
|
172
172
|
/**
|
|
@@ -176,27 +176,27 @@ export interface Mix<I, O, H = unknown> {
|
|
|
176
176
|
*/
|
|
177
177
|
sync(timestamp: number): void;
|
|
178
178
|
/**
|
|
179
|
-
*
|
|
180
|
-
*
|
|
179
|
+
* Leaves the time between the last sync and the next one uncounted. A host calls it when a hidden
|
|
180
|
+
* tab comes back. Every voice, fade and subject resumes where it was left.
|
|
181
181
|
*/
|
|
182
182
|
rebase(): void;
|
|
183
183
|
/**
|
|
184
|
-
* The mix's own playback rate, multiplied into every voice's
|
|
185
|
-
* whole mix. A negative rate throws: the mix plays only forward, and `seek` moves it back.
|
|
186
|
-
* once; `ramp` eases into a new one. It scales mix time, which
|
|
187
|
-
* its clock, its fades and a handle's ramp, `stagger`, an
|
|
188
|
-
* `history.ms`, every `dt`, and `setting.timestamp`. Timestamps
|
|
189
|
-
* moment whatever the rate does: a `start`, an anchor given as
|
|
190
|
-
* `marks` reports and the time `project` reads, so a start
|
|
191
|
-
* host's clock to reach it. A weight signal is still asked at
|
|
192
|
-
* input follows it while the mix is paused.
|
|
184
|
+
* The mix's own playback rate, multiplied into every voice's. 1 is real time and 0 pauses the
|
|
185
|
+
* whole mix. A negative rate throws: the mix plays only forward, and `seek` moves it back.
|
|
186
|
+
* Setting it changes speed at once; `ramp` eases into a new one. It scales mix time, which
|
|
187
|
+
* everything a voice owns runs on: its clock, its fades and a handle's ramp, `stagger`, an
|
|
188
|
+
* anchor's `by`, `stepMs`, `maxDt`, `history.ms`, every `dt`, and `setting.timestamp`. Timestamps
|
|
189
|
+
* on the host's clock name the same moment whatever the rate does: a `start`, an anchor given as
|
|
190
|
+
* a number, an announced mark, what `marks` reports and the time `project` reads, so a start
|
|
191
|
+
* ahead of a paused mix waits for the host's clock to reach it. A weight signal is still asked at
|
|
192
|
+
* every probe, so one reading host input follows it while the mix is paused.
|
|
193
193
|
*/
|
|
194
194
|
rate: number;
|
|
195
195
|
/**
|
|
196
|
-
* Moves the mix's rate to `rate` linearly over `over` ms of the host's clock
|
|
197
|
-
*
|
|
198
|
-
* on both multiplies and every position stays continuous. A later `rate`
|
|
199
|
-
* it.
|
|
196
|
+
* Moves the mix's rate to `rate` linearly over `over` ms of the host's clock. It works as
|
|
197
|
+
* `Handle.ramp` does on a voice's. Mix time integrates the ramp and a voice's clock integrates
|
|
198
|
+
* mix time, so a ramp on both multiplies and every position stays continuous. A later `rate`
|
|
199
|
+
* write or `ramp` replaces it.
|
|
200
200
|
*/
|
|
201
201
|
ramp(rate: number, over: number): void;
|
|
202
202
|
/**
|
|
@@ -209,8 +209,17 @@ export interface Mix<I, O, H = unknown> {
|
|
|
209
209
|
*/
|
|
210
210
|
probe(subject: I, out?: O): O;
|
|
211
211
|
/**
|
|
212
|
-
*
|
|
213
|
-
*
|
|
212
|
+
* A new empty pose, to pass as `probe`'s `out`. Each call makes its own object, holding every
|
|
213
|
+
* channel with a rest in kit order: a number rest at its value, any other `undefined` until a
|
|
214
|
+
* probe writes it. Make one and pass it as `probe`'s `out` every frame. An `out` made as `{}` or
|
|
215
|
+
* a literal shares V8's shapes with the host's other small objects, which can leave each number
|
|
216
|
+
* written into it boxed; this one has a shape of its own, so the mix writes numbers into it
|
|
217
|
+
* without allocating.
|
|
218
|
+
*/
|
|
219
|
+
pose(): O;
|
|
220
|
+
/**
|
|
221
|
+
* Writes each subject's pose into arrays, one per channel. Subjects go in the order given, each
|
|
222
|
+
* as `probe(subject, out)` gives it, without a pose object per subject. A channel of `n` numbers
|
|
214
223
|
* takes `n` places per subject, side by side; one with no value for a subject writes NaN there.
|
|
215
224
|
* Fastest while every voice runs on a lane, and when `subjects` is an array read again in the
|
|
216
225
|
* same order: the mix remembers the last array's subjects by position, holding them until the
|
|
@@ -242,34 +251,35 @@ export interface Mix<I, O, H = unknown> {
|
|
|
242
251
|
readonly frame: number;
|
|
243
252
|
}): Projection<I, O>;
|
|
244
253
|
/**
|
|
245
|
-
* Moves the mix to mix time `time
|
|
246
|
-
*
|
|
247
|
-
* `history` with a `tape`, which records the host's calls by the host time they were made
|
|
254
|
+
* Moves the mix to mix time `time` and plays on from there. It lands as the mix stood at the end
|
|
255
|
+
* of that frame; where rate 0 held the clock at `time` for several frames, the last of them.
|
|
256
|
+
* Needs `history` with a `tape`, which records the host's calls by the host time they were made
|
|
257
|
+
* at.
|
|
248
258
|
*
|
|
249
259
|
* Back, the mix restores itself: controls, records, voices and marks as they stood then. Voices
|
|
250
260
|
* that left after it are back on the handles the host holds, their `done` and `played` starting
|
|
251
261
|
* over where they had settled since. Voices cued after it wait as `pending` until the mix plays
|
|
252
262
|
* their cue again, and a write to the handle of one waiting changes nothing. Stateful voices
|
|
253
263
|
* restart from the copy `history` kept nearest before it and step once to it, exact under
|
|
254
|
-
* `stepMs`. A subject faded out of a voice or dropped after it comes back with the record it
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
264
|
+
* `stepMs`. A subject faded out of a voice or dropped after it comes back with the record it had,
|
|
265
|
+
* a motion patch's state included. Recorded input and host fields after it are let go: after a
|
|
266
|
+
* seek back, signals and host fields read live again, and `assess` reports what they fed as
|
|
267
|
+
* `held`.
|
|
258
268
|
*
|
|
259
269
|
* Forward, through a sync or a later seek, the mix plays the recorded calls again in the frames
|
|
260
|
-
* they were made in: cues, handle writes, fades, retargets and pushes, its rate, marks,
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
270
|
+
* they were made in: cues, handle writes, fades, retargets and pushes, its rate, marks, `mute`
|
|
271
|
+
* and `drop`. A call the host makes while there are recorded calls ahead starts a new branch, and
|
|
272
|
+
* the tape keeps the old future beside it; `tape.switchBranch` picks one back. Playing past a
|
|
273
|
+
* time again sends its events and books its marks and hits again.
|
|
264
274
|
*
|
|
265
|
-
* The host goes on passing its own clock: the next `sync` reads the moment sought plus the
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
275
|
+
* The host goes on passing its own clock: the next `sync` reads the moment sought plus the host's
|
|
276
|
+
* time since its last sync. Throws for a time older than history reaches, and before the first
|
|
277
|
+
* sync. With a history `store`, a time older than memory needs `prepare` first, or throws
|
|
278
|
+
* `HistoryMiss` before anything moves.
|
|
269
279
|
*
|
|
270
|
-
* Given `{ frame }`, a number `seq` read, it moves to the end of that frame instead, which is
|
|
271
|
-
*
|
|
272
|
-
*
|
|
280
|
+
* Given `{ frame }`, a number `seq` read, it moves to the end of that frame instead, which is how
|
|
281
|
+
* a host reaches an earlier one of several frames rate 0 held at one mix time. The frame has to
|
|
282
|
+
* be one history still holds: not let go with age, and not after a moment an earlier seek went
|
|
273
283
|
* back to. With a store, one older than memory needs `prepare` of its mix time first.
|
|
274
284
|
*/
|
|
275
285
|
seek(to: number | {
|
|
@@ -278,112 +288,161 @@ export interface Mix<I, O, H = unknown> {
|
|
|
278
288
|
/** As `Transport.prepare`, for a mix made alone. */
|
|
279
289
|
prepare(time: number): Promise<void>;
|
|
280
290
|
/**
|
|
281
|
-
* The mix clock at the last sync or seek
|
|
282
|
-
* sync. Host time at the mix's rate, less what `rebase` took out and `seek` moved.
|
|
291
|
+
* The mix clock at the last sync or seek. It is the time `seek` and `project` take; NaN before
|
|
292
|
+
* the first sync. Host time at the mix's rate, less what `rebase` took out and `seek` moved.
|
|
283
293
|
*/
|
|
284
294
|
readonly now: number;
|
|
285
295
|
/** The host's timestamp at the last sync; NaN before the first. */
|
|
286
296
|
readonly timestamp: number;
|
|
287
297
|
/**
|
|
288
|
-
* The number of the frame being played
|
|
289
|
-
*
|
|
298
|
+
* The number of the frame being played. `seek({ frame })` and `project({ frame })` take it. Each
|
|
299
|
+
* sync and seek begins a frame with a higher one, so two frames at one mix time differ.
|
|
290
300
|
*/
|
|
291
301
|
readonly seq: number;
|
|
292
302
|
/** The tape `history.tape` made, undefined without one. */
|
|
293
303
|
readonly tape: Tape | undefined;
|
|
294
304
|
/**
|
|
295
|
-
*
|
|
296
|
-
* of the subject this frame, it answers for the pose that probe gave, without
|
|
305
|
+
* Whether every channel is at rest for this subject this frame. A host can then skip the write.
|
|
306
|
+
* After a probe of the subject this frame, it answers for the pose that probe gave, without
|
|
307
|
+
* folding again.
|
|
297
308
|
*/
|
|
298
309
|
atRest(subject: I): boolean;
|
|
299
310
|
/**
|
|
300
|
-
* A handle on every voice still in the mix,
|
|
301
|
-
*
|
|
302
|
-
* that voice, so a listed handle is `===` the cued one.
|
|
311
|
+
* A handle on every voice still in the mix, in the order they were cued. That includes pending,
|
|
312
|
+
* live, frozen and fading voices; given a tag, only the voices whose `tags` carry it. Each is the
|
|
313
|
+
* handle `cue` returned for that voice, so a listed handle is `===` the cued one.
|
|
303
314
|
*/
|
|
304
315
|
voices(tag?: string): Handle<I>[];
|
|
305
316
|
/** Anything still contributing, fading, or pending. */
|
|
306
317
|
readonly live: boolean;
|
|
307
318
|
/**
|
|
308
|
-
*
|
|
309
|
-
* at a plain weight, or a motion whose every subject has landed on
|
|
310
|
-
* enough that every voice not done has started, at a plain weight,
|
|
311
|
-
* since the last sync, a retarget or a rate included, makes it
|
|
312
|
-
* it tells the mix the host may sleep: a voice cued with no
|
|
313
|
-
* at that sync.
|
|
319
|
+
* Whether another frame would change no pose, so a host's frame loop may sleep. It holds when
|
|
320
|
+
* every voice is done, frozen at a plain weight, or a motion whose every subject has landed on
|
|
321
|
+
* its target. At rate 0 it is enough that every voice not done has started, at a plain weight,
|
|
322
|
+
* with no anchor. A change made since the last sync, a retarget or a rate included, makes it
|
|
323
|
+
* false until the next. Read as true, it tells the mix the host may sleep: a voice cued with no
|
|
324
|
+
* `start` before the next sync starts at that sync.
|
|
314
325
|
*/
|
|
315
326
|
readonly inert: boolean;
|
|
316
327
|
/**
|
|
317
|
-
* Calls `fn` when a host call makes the mix need frames again after a sync
|
|
318
|
-
* handle's or the mix's rate, a seek, a `drop`, a motion retargeted. It fires once
|
|
319
|
-
* sync clears the change, and never during `sync`. Returns a function that
|
|
320
|
-
* A frame loop sleeping on `inert` subscribes here to wake.
|
|
328
|
+
* Calls `fn` when a host call makes the mix need frames again after a sync. Such a call is a cue,
|
|
329
|
+
* a fade, a handle's or the mix's rate, a seek, a `drop`, or a motion retargeted. It fires once
|
|
330
|
+
* until the next sync clears the change, and never during `sync`. Returns a function that
|
|
331
|
+
* unsubscribes `fn`. A frame loop sleeping on `inert` subscribes here to wake.
|
|
321
332
|
*/
|
|
322
333
|
onWake(fn: () => void): () => void;
|
|
323
334
|
/**
|
|
324
|
-
* Takes the mix off the list debuggers read (see `watched`)
|
|
325
|
-
* would otherwise stay until collected. Stops every watcher, and frees a hold no other listed
|
|
326
|
-
* on its transport shares. It still plays if synced.
|
|
335
|
+
* Takes the mix off the list debuggers read (see `watched`). It is for a host done with it, where
|
|
336
|
+
* it would otherwise stay until collected. Stops every watcher, and frees a hold no other listed
|
|
337
|
+
* mix on its transport shares. It still plays if synced.
|
|
327
338
|
*/
|
|
328
339
|
close(): void;
|
|
329
|
-
/** Fades every voice out
|
|
340
|
+
/** Fades every voice out. The ramp is `over` when given, else each voice's own `fade.out`. */
|
|
330
341
|
mute(opts?: {
|
|
331
342
|
over?: number;
|
|
332
343
|
}): void;
|
|
333
344
|
/**
|
|
334
|
-
* Forgets
|
|
335
|
-
*
|
|
345
|
+
* Forgets a subject's state, so nothing keeps the subject alive. That includes a motion patch's
|
|
346
|
+
* state for the subject, and any fade of the subject out of a voice.
|
|
336
347
|
*/
|
|
337
348
|
drop(subject: I): void;
|
|
338
349
|
/**
|
|
339
|
-
* Says that something a patch reads from outside the mix has changed since the last sync
|
|
340
|
-
* a table its `at` looks a subject up in
|
|
341
|
-
* have answered with what it read this frame. Given a subject, for that subject
|
|
342
|
-
* for every subject. The clock stays where it is and no `step` runs again, and
|
|
343
|
-
* loop sleeping on `inert`, as any change does.
|
|
350
|
+
* Says that something a patch reads from outside the mix has changed since the last sync. One
|
|
351
|
+
* such thing is a table its `at` looks a subject up in. The next probe calls the patch again
|
|
352
|
+
* where it would have answered with what it read this frame. Given a subject, for that subject
|
|
353
|
+
* only; with none, for every subject. The clock stays where it is and no `step` runs again, and
|
|
354
|
+
* it wakes a frame loop sleeping on `inert`, as any change does.
|
|
344
355
|
*/
|
|
345
356
|
touch(subject?: I): void;
|
|
346
357
|
/**
|
|
347
|
-
*
|
|
358
|
+
* The subject's index, which a `within` finder names it by. It is the one it has, or a new one.
|
|
359
|
+
* It keeps it until `drop`, or, for an object, until the host lets it go; then the index is
|
|
360
|
+
* handed to the next subject placed. A subject placed with no `plot` has no position until `put`
|
|
361
|
+
* gives it one.
|
|
362
|
+
*/
|
|
363
|
+
place(subject: I): number;
|
|
364
|
+
/**
|
|
365
|
+
* Gives the mix each subject's index and position at once, for voices cued `within` a circle. The
|
|
366
|
+
* index is the subject's place in `subjects`, and `xy` holds two numbers a subject, `x` then `y`,
|
|
367
|
+
* in that order. It is read in place, so a host moving its subjects writes into it and calls
|
|
368
|
+
* `moved`. `cell` sizes the grid the mix finds subjects in, best near the radius the circles use;
|
|
369
|
+
* by default, about two subjects a cell. Another call replaces the list and every index. A
|
|
370
|
+
* subject `place`d after it takes an index freed by `drop`, which reads whatever `xy` holds
|
|
371
|
+
* there, or one past the list, which has no position. Throws for an `xy` shorter than two numbers
|
|
372
|
+
* a subject.
|
|
373
|
+
*/
|
|
374
|
+
plot(subjects: readonly I[], xy: Float64Array, cell?: number): void;
|
|
375
|
+
/** Says the host wrote new positions into the array it gave `plot`. The next frame reads them. */
|
|
376
|
+
moved(): void;
|
|
377
|
+
/**
|
|
378
|
+
* Moves one subject to (`x`, `y`), for a host where few move at once. It writes into the array
|
|
379
|
+
* `plot` was given, so the host's array holds the move too, or with no `plot`, into the mix's
|
|
380
|
+
* own, and the grid is built again only once many subjects have left their cells. The same as
|
|
381
|
+
* writing the array and calling `moved`; the two mix freely. Throws for a subject with no index,
|
|
382
|
+
* and for one whose index is past the array `plot` was given.
|
|
383
|
+
*/
|
|
384
|
+
put(subject: I, x: number, y: number): void;
|
|
385
|
+
/**
|
|
386
|
+
* A weight signal over the positions `plot` or `put` gave, highest at a circle's center. It is 1
|
|
387
|
+
* at the center, falling with distance to 0 at `r` and beyond, along `ease` read from the edge
|
|
388
|
+
* (0) to the center (1), linear by default. The host moves or resizes the circle by writing to
|
|
389
|
+
* it. A voice it weighs is bounded to the circle as if cued `within` it, with no check, since the
|
|
390
|
+
* circle is the signal's own edge, from the first `place` or `plot` for one cued before it. A
|
|
391
|
+
* subject with no position reads 0.
|
|
392
|
+
*/
|
|
393
|
+
around(circle: Circle, opts?: {
|
|
394
|
+
ease?: Easing;
|
|
395
|
+
}): Signal<I, H>;
|
|
396
|
+
/**
|
|
397
|
+
* Puts a named mark on a score, for anchors to target as they target a voice's marks. A voice
|
|
348
398
|
* placed `{ with: 'reply' }` waits until the host announces `reply`. `at` is a timestamp on the
|
|
349
399
|
* host's clock, default now, and may lie ahead, so a read ahead sees it. A mark stays while it is
|
|
350
400
|
* ahead or while the mix's history reaches it.
|
|
351
401
|
*/
|
|
352
|
-
announce(name: string, opts?:
|
|
353
|
-
at?: number;
|
|
354
|
-
score?: string;
|
|
355
|
-
tags?: readonly string[];
|
|
356
|
-
}): void;
|
|
402
|
+
announce(name: string, opts?: AnnounceOptions): void;
|
|
357
403
|
/**
|
|
358
|
-
* Every mark the plan knows between two timestamps on the host's clock, earliest first
|
|
359
|
-
* voices start, are fully in, end their last pass, begin to fade and are gone, and what the
|
|
360
|
-
* announced. A mark
|
|
361
|
-
*
|
|
404
|
+
* Every mark the plan knows between two timestamps on the host's clock, earliest first. They are
|
|
405
|
+
* when voices start, are fully in, end their last pass, begin to fade and are gone, and what the
|
|
406
|
+
* host announced. A mark nothing has fixed yet, such as the out of a voice that loops for good,
|
|
407
|
+
* is not listed.
|
|
362
408
|
*/
|
|
363
409
|
marks(from: number, to: number): Marked[];
|
|
364
410
|
/**
|
|
365
|
-
* Every event patches have sent since the last drain, earliest first
|
|
366
|
-
*
|
|
367
|
-
* probed, so one nobody probes has sent nothing yet: promptness is the
|
|
368
|
-
* stateless patch's `at` on a lane is the exception: it runs at the frame's
|
|
369
|
-
* subject probed that frame or the last. Under `stepMs` each carries the
|
|
370
|
-
* what is sent and when does not depend on how the host
|
|
371
|
-
* sends nothing. Given a tag, it takes only the events
|
|
372
|
-
* whoever drains them.
|
|
411
|
+
* Every event patches have sent since the last drain, earliest first. Where two share a
|
|
412
|
+
* timestamp, they come in the order they were sent. A subject's events are made while it catches
|
|
413
|
+
* up, which is when it is probed, so one nobody probes has sent nothing yet: promptness is the
|
|
414
|
+
* host's, by probing. A stateless patch's `at` on a lane is the exception: it runs at the frame's
|
|
415
|
+
* first probe for every subject probed that frame or the last. Under `stepMs` each carries the
|
|
416
|
+
* end of the interval it happened in, so what is sent and when does not depend on how the host
|
|
417
|
+
* spaces its probes. Time `rebase` took out sends nothing. Given a tag, it takes only the events
|
|
418
|
+
* of voices carrying it and leaves the rest for whoever drains them.
|
|
373
419
|
*/
|
|
374
420
|
drain<E = unknown>(tag?: string): Sent<I, E>[];
|
|
375
421
|
/**
|
|
376
|
-
* Hands the host each mark and hit
|
|
377
|
-
* the thing itself: a sound on an `AudioContext`, a MIDI message with a timestamp, a
|
|
378
|
-
* before the voice that shows it starts. Booking runs at each `sync`, `ahead` ms
|
|
379
|
-
* booking whose time moves is stopped and taken again. Nothing is booked twice: a mark
|
|
380
|
-
* its voice and which mark, a hit by its voice, index and pass. `project` books
|
|
381
|
-
* nothing about booking is replayed under `history`. A mix with no booker pays
|
|
422
|
+
* Hands the host each mark and hit ahead of time, against a clock of its own. The host can then
|
|
423
|
+
* schedule the thing itself: a sound on an `AudioContext`, a MIDI message with a timestamp, a
|
|
424
|
+
* video loaded before the voice that shows it starts. Booking runs at each `sync`, `ahead` ms
|
|
425
|
+
* out, and a booking whose time moves is stopped and taken again. Nothing is booked twice: a mark
|
|
426
|
+
* is known by its voice and which mark, a hit by its voice, index and pass. `project` books
|
|
427
|
+
* nothing, and nothing about booking is replayed under `history`. A mix with no booker pays
|
|
428
|
+
* nothing for it.
|
|
382
429
|
*/
|
|
383
430
|
book<E = unknown>(opts: BookOptions<E, I>): Booker;
|
|
384
431
|
}
|
|
385
432
|
/**
|
|
386
|
-
*
|
|
433
|
+
* What `announce` takes besides the mark's name.
|
|
434
|
+
*
|
|
435
|
+
* @category mix
|
|
436
|
+
*/
|
|
437
|
+
export interface AnnounceOptions {
|
|
438
|
+
/** A timestamp on the host's clock, which may lie ahead. Default now. */
|
|
439
|
+
at?: number;
|
|
440
|
+
/** The score the mark goes on. Default: the mix's one unnamed score. */
|
|
441
|
+
score?: string;
|
|
442
|
+
tags?: readonly string[];
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* The implementation behind a mix. It says which patch forms it runs, and how it makes one.
|
|
387
446
|
*
|
|
388
447
|
* @category engine
|
|
389
448
|
*/
|