@msb235/blits 0.14.0 → 0.15.1
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 +198 -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 +37 -14
- 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.d.ts +2 -1
- package/dist/columns.js +62 -38
- 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 +16 -6
- package/dist/crowd.js +20 -11
- 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/delay.d.ts +3 -0
- package/dist/delay.js +7 -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 +114 -34
- package/dist/easing.d.ts +6 -4
- package/dist/easing.js +7 -3
- package/dist/everyone.d.ts +8 -2
- package/dist/everyone.js +33 -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 +52 -20
- 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/held.js +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 +38 -11
- package/dist/lane.js +46 -11
- package/dist/lanes.d.ts +30 -12
- package/dist/lanes.js +56 -36
- 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 +95 -7
- package/dist/mixer.d.ts +56 -37
- package/dist/mixer.js +57 -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 +6 -2
- package/dist/named.js +49 -3
- package/dist/numbers.d.ts +7 -0
- package/dist/numbers.js +33 -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 +22 -9
- package/dist/qualify.js +93 -31
- 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/renumber.d.ts +10 -0
- package/dist/renumber.js +75 -0
- 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 +28 -20
- package/dist/sample.d.ts +2 -2
- package/dist/sample.js +33 -7
- package/dist/seat.d.ts +17 -0
- package/dist/seat.js +25 -0
- 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 +23 -15
- 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/trace.d.ts +4 -0
- package/dist/trace.js +255 -0
- 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 +237 -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/trace.d.ts +51 -0
- package/dist/types/trace.js +1 -0
- package/dist/types/transport.d.ts +20 -18
- package/dist/types/voice.d.ts +144 -73
- package/dist/types/watch.d.ts +88 -40
- package/dist/types.d.ts +2 -0
- package/dist/unreached.d.ts +2 -0
- package/dist/unreached.js +7 -0
- package/dist/voice.d.ts +10 -143
- package/dist/voice.js +37 -82
- 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 +223 -34
- package/package.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Tape } from './history.js';
|
|
2
|
-
import type { Mix, MixOptions, Projection } from './mix.js';
|
|
2
|
+
import type { AnnounceOptions, Mix, MixOptions, Projection } from './mix.js';
|
|
3
3
|
import type { Marked } from './place.js';
|
|
4
4
|
/**
|
|
5
|
-
* How a transport is made
|
|
5
|
+
* How a transport is made. It says what history the transport keeps for every mix on it.
|
|
6
6
|
*
|
|
7
7
|
* @category mix
|
|
8
8
|
*/
|
|
@@ -10,8 +10,8 @@ export interface TransportOptions {
|
|
|
10
10
|
history?: MixOptions['history'];
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Every mix on a transport read at another mix time, with nothing live moved
|
|
14
|
-
* reading. Valid until the transport is next synced or a mix on it cued.
|
|
13
|
+
* Every mix on a transport read at another mix time, with nothing live moved. `of` gives one
|
|
14
|
+
* mix's reading. Valid until the transport is next synced or a mix on it cued.
|
|
15
15
|
*
|
|
16
16
|
* @category mix
|
|
17
17
|
*/
|
|
@@ -20,8 +20,8 @@ export interface TransportProjection {
|
|
|
20
20
|
of<I, O, H>(mix: Mix<I, O, H>): Projection<I, O>;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* One clock several mixes play on, each over its own kit
|
|
24
|
-
*
|
|
23
|
+
* One clock several mixes play on, each over its own kit. It gives them one sync, one rate, one
|
|
24
|
+
* seek and one tape, and a score that spans them, so an anchor in one mix waits on a voice in
|
|
25
25
|
* another by naming the score they share. A query naming no score stays in its own mix.
|
|
26
26
|
*
|
|
27
27
|
* @category mix
|
|
@@ -35,7 +35,7 @@ export interface Transport {
|
|
|
35
35
|
rate: number;
|
|
36
36
|
ramp(rate: number, over: number): void;
|
|
37
37
|
/**
|
|
38
|
-
* As `Mix.seek`, for every mix on it at once
|
|
38
|
+
* As `Mix.seek`, for every mix on it at once. Back, each mix restores itself; forward, the one
|
|
39
39
|
* tape plays every mix's calls again in the order they were made, so an anchor across mixes
|
|
40
40
|
* answers as it did. A mix dropped after the moment sought is back on the transport.
|
|
41
41
|
*/
|
|
@@ -43,25 +43,24 @@ export interface Transport {
|
|
|
43
43
|
readonly frame: number;
|
|
44
44
|
}): void;
|
|
45
45
|
/**
|
|
46
|
-
* Loads from the history `store` what
|
|
47
|
-
* reaches past memory. Without a store, or within
|
|
46
|
+
* Loads from the history `store` what a seek or projection to `time` will need. That is, what
|
|
47
|
+
* `seek(time)` and `project(time)` need where it reaches past memory. Without a store, or within
|
|
48
|
+
* memory, it loads nothing.
|
|
48
49
|
*/
|
|
49
50
|
prepare(time: number): Promise<void>;
|
|
50
51
|
readonly now: number;
|
|
51
|
-
/** As `Mix.seq
|
|
52
|
+
/** As `Mix.seq`, the number of the frame being played. It is the same for every mix on it. */
|
|
52
53
|
readonly seq: number;
|
|
53
54
|
readonly tape: Tape | undefined;
|
|
54
55
|
/** Puts a named mark on a score every mix on it sees. Throws without a `score`. */
|
|
55
|
-
announce(name: string, opts: {
|
|
56
|
-
at?: number;
|
|
56
|
+
announce(name: string, opts: AnnounceOptions & {
|
|
57
57
|
score: string;
|
|
58
|
-
tags?: readonly string[];
|
|
59
58
|
}): void;
|
|
60
59
|
/** Every mark of every mix on it, and every mark announced on it, earliest first. */
|
|
61
60
|
marks(from: number, to: number): Marked[];
|
|
62
61
|
/**
|
|
63
|
-
* Every mix on it read at mix time `at`, or
|
|
64
|
-
* across them answer.
|
|
62
|
+
* Every mix on it read together at another time. The time is mix time `at`, or the frame
|
|
63
|
+
* `{ frame }` names, and reading them together lets anchors across them answer.
|
|
65
64
|
*/
|
|
66
65
|
project(at: number | {
|
|
67
66
|
readonly frame: number;
|
|
@@ -70,11 +69,14 @@ export interface Transport {
|
|
|
70
69
|
readonly live: boolean;
|
|
71
70
|
/** Every mix on it inert. */
|
|
72
71
|
readonly inert: boolean;
|
|
73
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* Calls `fn` when any mix on it needs frames again after a sync. It fires once until the next
|
|
74
|
+
* sync.
|
|
75
|
+
*/
|
|
74
76
|
onWake(fn: () => void): () => void;
|
|
75
77
|
/**
|
|
76
|
-
* Takes a mix off
|
|
77
|
-
* before the drop puts it back as it was then; without, it is let go.
|
|
78
|
+
* Takes a mix off the transport. It is no longer synced and takes no more calls. With history, a
|
|
79
|
+
* seek back before the drop puts it back as it was then; without, it is let go.
|
|
78
80
|
*/
|
|
79
81
|
drop<I, O, H>(mix: Mix<I, O, H>): void;
|
|
80
82
|
}
|
package/dist/types/voice.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Fit, Order, Strength } from '../fit.js';
|
|
2
|
-
import type { Motion, Value } from '../motion.js';
|
|
3
2
|
import type { Described } from './history.js';
|
|
4
3
|
import type { Doubt } from './mix.js';
|
|
4
|
+
import type { Motion, Value } from './motion.js';
|
|
5
5
|
import type { Easing, Patch, Signal } from './patch.js';
|
|
6
6
|
import type { Anchor, Hit, Placement } from './place.js';
|
|
7
7
|
/**
|
|
@@ -15,42 +15,68 @@ export interface FadeSpec {
|
|
|
15
15
|
ease?: Easing;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* How a
|
|
19
|
-
* fit reads. Anything it does not allow, it will not do. Read only under a span.
|
|
18
|
+
* How a span's child may give way so the span keeps its budget. A child is a voice or owner
|
|
19
|
+
* held by a span, and the span's fit reads this. Anything it does not allow, it will not do. Read only under a span.
|
|
20
20
|
*
|
|
21
21
|
* @category score
|
|
22
22
|
*/
|
|
23
23
|
export interface SpanHints {
|
|
24
|
-
/** How many times faster than its own rate it may play. Default 1
|
|
24
|
+
/** How many times faster than its own rate it may play. Default 1, no faster. */
|
|
25
25
|
faster?: number;
|
|
26
|
-
/** How many times slower than its own rate it may play. Default 1
|
|
26
|
+
/** How many times slower than its own rate it may play. Default 1, no slower. */
|
|
27
27
|
slower?: number;
|
|
28
|
-
/** Whether it may start before the one before it ends, where the span's order would not. */
|
|
28
|
+
/** Whether it may start before the one before it ends, even where the span's order would not. */
|
|
29
29
|
overlap?: boolean;
|
|
30
30
|
/** Whether it may jump to its end instead of playing. A span held by a span is never skipped. */
|
|
31
31
|
ballast?: boolean;
|
|
32
32
|
/** How hard its own length holds against the span's budget. Default `weak`. */
|
|
33
33
|
priority?: Strength;
|
|
34
34
|
/**
|
|
35
|
-
* The soonest it may start
|
|
35
|
+
* The soonest it may start, as a time on the span's clock or an anchor. The fit never places it
|
|
36
36
|
* sooner, and the children after it are laid out from where it starts. One already past when it is
|
|
37
37
|
* cued places it there, partway through. One whose anchor has no answer yet waits, and under `queue` or
|
|
38
38
|
* `stagger` so does every child after it.
|
|
39
39
|
*/
|
|
40
40
|
earliest?: number | Anchor;
|
|
41
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Where it plays among the span's children still to start. Lower goes first, and ties go as cued.
|
|
43
|
+
* Default 0.
|
|
44
|
+
*/
|
|
42
45
|
rank?: number;
|
|
43
46
|
}
|
|
44
47
|
/**
|
|
45
|
-
*
|
|
48
|
+
* A circle by its center, `x` and `y`, and radius `r`. It is in the units of the positions `plot`
|
|
49
|
+
* gave.
|
|
50
|
+
*
|
|
51
|
+
* @category voice
|
|
52
|
+
*/
|
|
53
|
+
export interface Circle {
|
|
54
|
+
x: number;
|
|
55
|
+
y: number;
|
|
56
|
+
r: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The host's own answer to where a `within` signal can be above 0. It works over any axes or
|
|
60
|
+
* none. Once a
|
|
61
|
+
* frame, `find` writes into `out`, from 0, the indices `place` or `plot` gave the subjects the
|
|
62
|
+
* signal can be above 0 for, and returns how many it wrote. `out` has room for every index handed
|
|
63
|
+
* out; a repeat is read once, and an index no subject holds is skipped.
|
|
64
|
+
*
|
|
65
|
+
* @category voice
|
|
66
|
+
*/
|
|
67
|
+
export interface Finder {
|
|
68
|
+
find(out: Int32Array): number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* What `cue` takes. That is a patch, and the clock, weight and reach it plays with.
|
|
46
72
|
*
|
|
47
73
|
* @category voice
|
|
48
74
|
*/
|
|
49
75
|
export interface VoiceSpec<I, O, H = unknown> extends SpanHints {
|
|
50
76
|
patch: Patch<I, O, any, H>;
|
|
51
77
|
/**
|
|
52
|
-
* What `history.revive` rebuilds this spec from
|
|
53
|
-
* it has left. A voice cued without it stays in memory for as long as history reaches it.
|
|
78
|
+
* What `history.revive` rebuilds this spec from. It lets a history `store` page the voice out
|
|
79
|
+
* once it has left. A voice cued without it stays in memory for as long as history reaches it.
|
|
54
80
|
*/
|
|
55
81
|
as?: Described;
|
|
56
82
|
/**
|
|
@@ -63,14 +89,14 @@ export interface VoiceSpec<I, O, H = unknown> extends SpanHints {
|
|
|
63
89
|
*/
|
|
64
90
|
target?: (subject: I) => boolean;
|
|
65
91
|
/**
|
|
66
|
-
* The subjects this voice reaches, fixed at `cue` and matched by identity
|
|
67
|
-
* never asks this voice. Takes the place of `target`, and a cue giving both is refused
|
|
92
|
+
* The subjects this voice reaches, fixed at `cue` and matched by identity. A probe of any other
|
|
93
|
+
* never asks this voice. Takes the place of `target`, and a cue giving both is refused, since a
|
|
68
94
|
* predicate over a fixed list is that list filtered, which the host can do before cueing.
|
|
69
95
|
*/
|
|
70
96
|
subjects?: readonly I[];
|
|
71
97
|
/**
|
|
72
|
-
* When the voice starts, in ms on the host's clock
|
|
73
|
-
* `performance.now()` share an origin, `Date.now()` does not. Default: the time the mix last
|
|
98
|
+
* When the voice starts, in ms on the host's clock. That is the clock it passes `sync`: a rAF
|
|
99
|
+
* timestamp and `performance.now()` share an origin, `Date.now()` does not. Default: the time the mix last
|
|
74
100
|
* synced to, and 0 for a voice cued before the first sync, which that sync finds already as far
|
|
75
101
|
* in as its timestamp. Where the host read `inert` as true since the last sync, its frame loop
|
|
76
102
|
* may be asleep, and the default is the next sync instead, so a voice cued after a long pause
|
|
@@ -93,8 +119,8 @@ export interface VoiceSpec<I, O, H = unknown> extends SpanHints {
|
|
|
93
119
|
*/
|
|
94
120
|
seek?: number;
|
|
95
121
|
/**
|
|
96
|
-
* The interval this voice's `step` runs at, in ms of mix time
|
|
97
|
-
* 0 steps it once a frame by the frame's gap, whatever the mix sets. Default: the mix's.
|
|
122
|
+
* The interval this voice's `step` runs at, in ms of mix time. It takes the place of the mix's
|
|
123
|
+
* `stepMs`. 0 steps it once a frame by the frame's gap, whatever the mix sets. Default: the mix's.
|
|
98
124
|
*/
|
|
99
125
|
stepMs?: number;
|
|
100
126
|
/**
|
|
@@ -107,20 +133,25 @@ export interface VoiceSpec<I, O, H = unknown> extends SpanHints {
|
|
|
107
133
|
*/
|
|
108
134
|
catchUp?: 'exact' | 'fresh';
|
|
109
135
|
/**
|
|
110
|
-
* true loops for good, false plays one pass, n plays n passes.
|
|
111
|
-
*
|
|
112
|
-
*
|
|
136
|
+
* How many passes the voice plays. true loops for good, false plays one pass, n plays n passes.
|
|
137
|
+
* A finite loop leaves when its
|
|
138
|
+
* passes are done for its latest-staggered subject — over `fade.out` where one is set, at once
|
|
139
|
+
* where none is — unless it freezes after. Default: false.
|
|
113
140
|
*/
|
|
114
141
|
loop?: boolean | number;
|
|
115
142
|
/**
|
|
116
|
-
* Per-subject delay in voice ms
|
|
117
|
-
*
|
|
143
|
+
* Per-subject delay in voice ms. It is klieg's stagger grammar reduced to the one thing the mix
|
|
144
|
+
* needs. It runs once per subject and the answer is kept: at `cue` for every subject a voice
|
|
145
|
+
* names in `subjects`, else, like `target`, on first sight. So a voice naming its subjects ends by
|
|
146
|
+
* all of them, and one reaching them by `target` ends by those the mix has been asked about: a
|
|
147
|
+
* subject first read later than that sees a finite loop already over.
|
|
118
148
|
*/
|
|
119
149
|
stagger?: (subject: I) => number;
|
|
120
150
|
/**
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
151
|
+
* Which edge frames a subject is shown while the voice is not playing. `before` shows the first
|
|
152
|
+
* frame before it starts, while the voice is pending and while the subject waits out its
|
|
153
|
+
* `stagger`; `after` shows the last frame of the last pass after a finite loop plays out; `both`
|
|
154
|
+
* shows both. A frozen subject's clock stands still: `at` is asked for the edge frame and `step`
|
|
124
155
|
* does not run, past one last step to the end of the last pass. `fade.in` counts from the first
|
|
125
156
|
* frame the voice shows. A voice freezing after stays, `frozen`, until `fade()` or an anchored
|
|
126
157
|
* `out` takes it out, so every one cued must be faded or it stays in the mix for good. Does
|
|
@@ -129,13 +160,32 @@ export interface VoiceSpec<I, O, H = unknown> extends SpanHints {
|
|
|
129
160
|
freeze?: 'before' | 'after' | 'both';
|
|
130
161
|
/** Steady weight, or a signal read per subject per frame. Default 1. */
|
|
131
162
|
weight?: number | Signal<I, H>;
|
|
163
|
+
/**
|
|
164
|
+
* Where the `weight` signal can be above 0. It is a circle the host moves by writing to it, read
|
|
165
|
+
* once a frame, over the positions `plot` or `put` gave, or a `Finder` the host answers by index.
|
|
166
|
+
* Outside
|
|
167
|
+
* it the voice gives a subject nothing and the signal is not read, so a frame visits only the
|
|
168
|
+
* subjects within rather than all of them. The signal has to be 0 outside already, or the bound
|
|
169
|
+
* cuts it off: outside production, every few frames, the mix reads it for a few subjects just
|
|
170
|
+
* outside and warns once if one is above 0.
|
|
171
|
+
* A patch that steps still steps outside, and a `from: 'current'` voice still takes its base,
|
|
172
|
+
* as each does at weight 0. Needs `place` or `plot` first, and a signal `weight`.
|
|
173
|
+
*/
|
|
174
|
+
within?: Circle | Finder;
|
|
132
175
|
/** Ramp in and out, ms. Out applies on `fade()` and when a finite loop ends. */
|
|
133
176
|
fade?: FadeSpec;
|
|
134
|
-
/**
|
|
177
|
+
/**
|
|
178
|
+
* The role this voice plays; voices in one role are alternatives. Whichever plays it, the subject
|
|
179
|
+
* shows one performance, not two stacked. The mix folds them through each channel's `lerp`.
|
|
180
|
+
*/
|
|
181
|
+
role?: string;
|
|
182
|
+
/** @deprecated Renamed `role`. Taken as `role`, with a warning outside production. */
|
|
135
183
|
locus?: string;
|
|
136
184
|
/** A `keys` voice whose first stop reads wherever this subject is now. */
|
|
137
185
|
from?: 'current';
|
|
138
|
-
/**
|
|
186
|
+
/**
|
|
187
|
+
* Words a source attaches to this voice. They let its events and its handle be taken as a set.
|
|
188
|
+
*/
|
|
139
189
|
tags?: readonly string[];
|
|
140
190
|
/** What other voices call this one by. A label blits never reads. */
|
|
141
191
|
name?: string;
|
|
@@ -153,15 +203,15 @@ export interface VoiceSpec<I, O, H = unknown> extends SpanHints {
|
|
|
153
203
|
*/
|
|
154
204
|
hits?: readonly Hit[];
|
|
155
205
|
/**
|
|
156
|
-
* Named marks inside the voice, beside its five
|
|
157
|
-
* `{ drop: 340 }`. An anchor names one as it names the five, `{ of: 'lead', mark: 'drop' }`, and
|
|
206
|
+
* Named marks inside the voice, beside its five. Each is at voice ms into a pass, as a hit's `at`
|
|
207
|
+
* is: `{ drop: 340 }`. An anchor names one as it names the five, `{ of: 'lead', mark: 'drop' }`, and
|
|
158
208
|
* `marks` lists it and `book` books it under its name. Each is reached once: on the first pass
|
|
159
209
|
* that reaches it from where the voice starts, while its clock runs forward and before it ends.
|
|
160
210
|
* A name cannot be one of the five.
|
|
161
211
|
*/
|
|
162
212
|
marks?: Readonly<Record<string, number>>;
|
|
163
213
|
/**
|
|
164
|
-
* The owner this voice plays under, a handle `owns` returned. Its `start` and `anchor` are then on
|
|
214
|
+
* The owner this voice plays under, as a handle `owns` returned. Its `start` and `anchor` are then on
|
|
165
215
|
* the owner's clock, in ms from when the owner starts, and default to where that clock is now; a
|
|
166
216
|
* bare name in an anchor means a sibling, another voice the owner holds. Its clock runs on the
|
|
167
217
|
* owner's, so the owner's rate, ramp and seeks move it, and its weight is multiplied by the
|
|
@@ -170,7 +220,7 @@ export interface VoiceSpec<I, O, H = unknown> extends SpanHints {
|
|
|
170
220
|
owner?: Handle<I>;
|
|
171
221
|
}
|
|
172
222
|
/**
|
|
173
|
-
* One of `mix.blend`'s members, with the labels it carries in place of the spec's
|
|
223
|
+
* One of `mix.blend`'s members, with the labels it carries in place of the spec's. Each set here
|
|
174
224
|
* replaces the spec's for this member alone. The rest of the spec times and places every member
|
|
175
225
|
* alike, so they stay one blend.
|
|
176
226
|
*
|
|
@@ -180,20 +230,20 @@ export interface BlendMember<I, O, H = unknown> {
|
|
|
180
230
|
patch: Patch<I, O, any, H>;
|
|
181
231
|
/** What other voices call this member by. Default: the spec's `name`. */
|
|
182
232
|
name?: string;
|
|
183
|
-
/** Default: the spec's `tags`. */
|
|
233
|
+
/** The member's tags. Default: the spec's `tags`. */
|
|
184
234
|
tags?: readonly string[];
|
|
185
235
|
/** Events at times on this member's clock, as a voice's `hits`. Default: the spec's. */
|
|
186
236
|
hits?: readonly Hit[];
|
|
187
237
|
}
|
|
188
238
|
/**
|
|
189
|
-
* What `owns` takes
|
|
239
|
+
* What `owns` takes. An owner has no patch, and plays only through the voices it holds.
|
|
190
240
|
*
|
|
191
241
|
* @category voice
|
|
192
242
|
*/
|
|
193
243
|
export interface OwnerSpec<I, H = unknown> extends SpanHints {
|
|
194
244
|
/**
|
|
195
|
-
* When the owner starts, on its own owner's clock
|
|
196
|
-
* voice's `start` is. Default: now.
|
|
245
|
+
* When the owner starts, on its own owner's clock. That is the host's clock for an owner on the
|
|
246
|
+
* mix, as a voice's `start` is. Default: now.
|
|
197
247
|
*/
|
|
198
248
|
start?: number;
|
|
199
249
|
/**
|
|
@@ -204,14 +254,14 @@ export interface OwnerSpec<I, H = unknown> extends SpanHints {
|
|
|
204
254
|
*/
|
|
205
255
|
rate?: number;
|
|
206
256
|
/**
|
|
207
|
-
* Where its clock starts, ms, as `seek` on its handle sets
|
|
257
|
+
* Where its clock starts, ms, as `seek` on its handle sets. Its children play as far in as that
|
|
208
258
|
* puts them. Default 0, cued backward too, since an owner has no end of its own to start from; one
|
|
209
259
|
* cued at a rate below 0 with no seek runs back from 0, before any child placed on its clock.
|
|
210
260
|
*/
|
|
211
261
|
seek?: number;
|
|
212
262
|
/**
|
|
213
|
-
* Multiplied into every child's weight per subject
|
|
214
|
-
*
|
|
263
|
+
* Multiplied into every child's weight per subject. It applies as the child's own fade does,
|
|
264
|
+
* before the child's role folds it: a number, or a signal read per subject per frame. Default 1.
|
|
215
265
|
*/
|
|
216
266
|
weight?: number | Signal<I, H>;
|
|
217
267
|
/** One ramp in and out over every child, multiplied into their weights as `weight` is. */
|
|
@@ -224,11 +274,14 @@ export interface OwnerSpec<I, H = unknown> extends SpanHints {
|
|
|
224
274
|
name?: string;
|
|
225
275
|
/** The plan it belongs to, as a voice's. */
|
|
226
276
|
score?: string;
|
|
227
|
-
/**
|
|
277
|
+
/**
|
|
278
|
+
* Where it sits relative to its own owner's clock or to other voices. It takes the place of
|
|
279
|
+
* `start`.
|
|
280
|
+
*/
|
|
228
281
|
anchor?: Placement;
|
|
229
282
|
/**
|
|
230
|
-
* Events at times on its own clock,
|
|
231
|
-
*
|
|
283
|
+
* Events at times on its own clock, which `book` hands a host ahead of time. That is the clock its
|
|
284
|
+
* children's `start` counts on, and they go with its `score` and `tags`. An owner does not loop, so each is
|
|
232
285
|
* booked once, while it plays: none past where it leaves, and none while its clock runs back.
|
|
233
286
|
*/
|
|
234
287
|
hits?: readonly Hit[];
|
|
@@ -238,8 +291,8 @@ export interface OwnerSpec<I, H = unknown> extends SpanHints {
|
|
|
238
291
|
owner?: Handle<I>;
|
|
239
292
|
}
|
|
240
293
|
/**
|
|
241
|
-
* What `span` takes
|
|
242
|
-
*
|
|
294
|
+
* What `span` takes, an owner with a budget. It lays out the voices it holds in an order and fits
|
|
295
|
+
* them into the budget.
|
|
243
296
|
*
|
|
244
297
|
* @category score
|
|
245
298
|
*/
|
|
@@ -253,13 +306,13 @@ export interface SpanSpec<I, H = unknown> extends OwnerSpec<I, H> {
|
|
|
253
306
|
/** How far through the one before a child starts under `stagger`, 0..1. Default 0.5. */
|
|
254
307
|
share?: number;
|
|
255
308
|
/**
|
|
256
|
-
* How the children are fitted once they are retimed toward the budget
|
|
257
|
-
* their hints allow. Default `pipe(condense(), shed())`.
|
|
309
|
+
* How the children are fitted once they are retimed toward the budget. They are retimed faster
|
|
310
|
+
* or slower as their hints allow. Default `pipe(condense(), shed())`.
|
|
258
311
|
*/
|
|
259
312
|
fit?: Fit;
|
|
260
313
|
/**
|
|
261
|
-
* What happens where the fit leaves
|
|
262
|
-
* every child weaker than the span to its end at once, and `overrun` lets them run long.
|
|
314
|
+
* What happens where the fit leaves the children too long for a span at least `strong`.
|
|
315
|
+
* `instant` jumps every child weaker than the span to its end at once, and `overrun` lets them run long.
|
|
263
316
|
* Default `instant`.
|
|
264
317
|
*/
|
|
265
318
|
spill?: 'instant' | 'overrun';
|
|
@@ -282,7 +335,7 @@ export interface FitResult {
|
|
|
282
335
|
fell: boolean;
|
|
283
336
|
}
|
|
284
337
|
/**
|
|
285
|
-
* A span's handle
|
|
338
|
+
* A span's handle. It is an owner's, and reports how its children were last fitted.
|
|
286
339
|
*
|
|
287
340
|
* @category score
|
|
288
341
|
*/
|
|
@@ -290,15 +343,21 @@ export interface SpanHandle<I = unknown> extends Handle<I> {
|
|
|
290
343
|
readonly result: FitResult;
|
|
291
344
|
}
|
|
292
345
|
/**
|
|
293
|
-
* How a voice leaves when it is faded
|
|
346
|
+
* How a voice leaves when it is faded. It fades the whole voice, or one subject.
|
|
347
|
+
*
|
|
348
|
+
* @category blending
|
|
349
|
+
*/
|
|
350
|
+
export type FadeOptions<I = unknown> = VoiceFade | SubjectFade<I>;
|
|
351
|
+
/**
|
|
352
|
+
* A fade of the whole voice, as `FadeOptions` takes it.
|
|
294
353
|
*
|
|
295
354
|
* @category blending
|
|
296
355
|
*/
|
|
297
|
-
export
|
|
356
|
+
export interface VoiceFade {
|
|
298
357
|
/** The ramp, ms. Defaults to the voice's own `fade.out`. */
|
|
299
358
|
over?: number;
|
|
300
359
|
/**
|
|
301
|
-
* When the fade begins
|
|
360
|
+
* When the fade begins, as a mix time or `'rest'`. A mix time: ahead, the voice plays untouched until then and begins
|
|
302
361
|
* its fade exactly there, its `out` mark fixed from now, and `rise` before then takes it
|
|
303
362
|
* back with nothing changed; at or behind now, the fade began then and is partway. `'rest'`:
|
|
304
363
|
* leave per subject at the first frame that subject's contribution is at rest. Default now.
|
|
@@ -307,16 +366,23 @@ export type FadeOptions<I = unknown> = {
|
|
|
307
366
|
/** Ms after which the voice leaves whether or not it rested. */
|
|
308
367
|
deadline?: number;
|
|
309
368
|
subject?: never;
|
|
310
|
-
}
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* A fade of one subject out of a voice, as `FadeOptions` takes it.
|
|
372
|
+
*
|
|
373
|
+
* @category blending
|
|
374
|
+
*/
|
|
375
|
+
export interface SubjectFade<I = unknown> {
|
|
311
376
|
/**
|
|
312
377
|
* The one subject to fade out of this voice, which plays on for the rest. Once the ramp ends
|
|
313
378
|
* the voice forgets the subject and reaches it no more, until a motion patch's `to` or `push`
|
|
314
|
-
* or the mix's `drop` brings it back, met afresh: `from
|
|
379
|
+
* or the mix's `drop` brings it back, met afresh: `from` and `target` asked again, and
|
|
380
|
+
* `stagger` too unless the voice names its `subjects`.
|
|
315
381
|
*/
|
|
316
382
|
subject: I;
|
|
317
383
|
/** The ramp, ms. Defaults to the voice's own `fade.out`; 0 takes the subject out at once. */
|
|
318
384
|
over?: number;
|
|
319
|
-
}
|
|
385
|
+
}
|
|
320
386
|
/**
|
|
321
387
|
* The live controls on one voice, returned by `cue`.
|
|
322
388
|
*
|
|
@@ -324,11 +390,16 @@ export type FadeOptions<I = unknown> = {
|
|
|
324
390
|
*/
|
|
325
391
|
export interface Handle<I = unknown> {
|
|
326
392
|
readonly id: number;
|
|
327
|
-
/**
|
|
393
|
+
/**
|
|
394
|
+
* Where the voice is in its life. `frozen`: a voice freezing after has played every pass and shows
|
|
395
|
+
* its last frame until faded.
|
|
396
|
+
*/
|
|
328
397
|
readonly state: 'pending' | 'live' | 'frozen' | 'fading' | 'done';
|
|
329
|
-
/** The handle of the owner this voice plays under
|
|
398
|
+
/** The handle of the owner this voice plays under. Undefined for one on the mix clock. */
|
|
330
399
|
readonly owner: Handle<I> | undefined;
|
|
331
|
-
/**
|
|
400
|
+
/**
|
|
401
|
+
* The voice's weight now, which can be written while it plays. A write shows at the next probe.
|
|
402
|
+
*/
|
|
332
403
|
weight: number;
|
|
333
404
|
/**
|
|
334
405
|
* Playback rate now. Setting it changes speed at once; `ramp` eases into a new one. On a voice
|
|
@@ -337,7 +408,7 @@ export interface Handle<I = unknown> {
|
|
|
337
408
|
*/
|
|
338
409
|
rate: number;
|
|
339
410
|
/**
|
|
340
|
-
* Moves the rate to `rate` linearly over `over` mix ms
|
|
411
|
+
* Moves the rate to `rate` linearly over `over` mix ms. A pause or a slow-motion then eases in
|
|
341
412
|
* rather than snapping. The voice clock integrates the ramp, so its position stays continuous and
|
|
342
413
|
* its speed does too. A later `rate` write or `ramp` replaces it; `seek` keeps it.
|
|
343
414
|
*/
|
|
@@ -359,9 +430,8 @@ export interface Handle<I = unknown> {
|
|
|
359
430
|
*/
|
|
360
431
|
fade(opts?: FadeOptions<I>): void;
|
|
361
432
|
/**
|
|
362
|
-
* Turns a fade out around
|
|
363
|
-
* curve, over `over` ms for the whole curve (default its `fade.in`, else its `fade.out`)
|
|
364
|
-
* plays on as if never faded. A fade waiting for rest is taken back at once; a voice not fading
|
|
433
|
+
* Turns a fade out around, so the voice plays on as if never faded. It climbs back from where its
|
|
434
|
+
* fade had got to, up the same curve, over `over` ms for the whole curve (default its `fade.in`, else its `fade.out`). A fade waiting for rest is taken back at once; a voice not fading
|
|
365
435
|
* is left as it is. A voice whose own end began the fade starts it again at its next frame. A
|
|
366
436
|
* voice faded before its start goes back to `pending` and starts on time.
|
|
367
437
|
*/
|
|
@@ -369,43 +439,44 @@ export interface Handle<I = unknown> {
|
|
|
369
439
|
over?: number;
|
|
370
440
|
}): void;
|
|
371
441
|
/**
|
|
372
|
-
* The weight this voice gave `subject` the last frame that subject was probed
|
|
373
|
-
* and its weight signal, before a
|
|
442
|
+
* The weight this voice gave `subject` the last frame that subject was probed. That is after its
|
|
443
|
+
* fades and its weight signal, before a role folds it with its alternatives. 0 for a subject it does
|
|
374
444
|
* not reach, has not started on and does not freeze before, has left at rest, or has never been
|
|
375
445
|
* probed for; 0 once done, and 0 after `mix.seek` goes back until the subject is probed again.
|
|
376
446
|
* Costs nothing until it is asked.
|
|
377
447
|
*/
|
|
378
448
|
weightOf(subject: I): number;
|
|
379
449
|
/**
|
|
380
|
-
* Heads `subject` for `target`, for a voice playing a `spring` or a `tween
|
|
381
|
-
* reached without holding the patch. Throws for any other voice.
|
|
450
|
+
* Heads `subject` for `target`, for a voice playing a `spring` or a `tween`. It is the patch's own
|
|
451
|
+
* `to`, reached without holding the patch. Throws for any other voice.
|
|
382
452
|
*/
|
|
383
453
|
to(subject: I, target: Value, at?: number): void;
|
|
384
454
|
/**
|
|
385
|
-
* Sets `subject` moving at `velocity`,
|
|
386
|
-
*
|
|
455
|
+
* Sets `subject` moving at `velocity`, for a voice playing a `spring` or a `glide`. The velocity
|
|
456
|
+
* is in units per second, and this is the patch's own `push`. Throws for any other voice.
|
|
387
457
|
*/
|
|
388
458
|
push(subject: I, velocity: Value, at?: number): void;
|
|
389
459
|
/**
|
|
390
|
-
* Puts `subject` at `value`, keeping its velocity, for a voice playing any motion patch
|
|
460
|
+
* Puts `subject` at `value`, keeping its velocity, for a voice playing any motion patch. It is the
|
|
391
461
|
* patch's own `set`. Throws for any other voice.
|
|
392
462
|
*/
|
|
393
463
|
set(subject: I, value: Value, at?: number): void;
|
|
394
464
|
/**
|
|
395
|
-
* Where `subject` is and how fast it moves, for a voice playing a motion patch
|
|
396
|
-
* `read`. Undefined for any other voice, and wherever the patch's `read` is.
|
|
465
|
+
* Where `subject` is and how fast it moves, for a voice playing a motion patch. It is the patch's
|
|
466
|
+
* own `read`. Undefined for any other voice, and wherever the patch's `read` is.
|
|
397
467
|
*/
|
|
398
468
|
read(subject: I, at?: number): Motion<Value> | undefined;
|
|
399
469
|
/** Resolves when the voice has been removed from the mix, however that happened. */
|
|
400
470
|
readonly done: Promise<void>;
|
|
401
471
|
/**
|
|
402
|
-
* Resolves true when a finite loop's last pass ends,
|
|
403
|
-
*
|
|
472
|
+
* Resolves true when a finite loop's last pass ends, false if the voice leaves before that. The
|
|
473
|
+
* last pass is the one for its latest-staggered subject; `stagger` says which subjects count.
|
|
474
|
+
* Never rejects.
|
|
404
475
|
*/
|
|
405
476
|
readonly played: Promise<boolean>;
|
|
406
477
|
}
|
|
407
478
|
/**
|
|
408
|
-
* What `Handle.seek` does with each subject's state
|
|
479
|
+
* What `Handle.seek` does with each subject's state. `rebuild` (the default) makes it fresh and
|
|
409
480
|
* steps it to the new position; `keep` leaves it as it was, except for a subject the seek sends back
|
|
410
481
|
* before its start, which starts afresh there.
|
|
411
482
|
*
|