@msb235/blits 0.7.1 → 0.8.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 +180 -0
- package/README.md +22 -4
- package/dist/book.js +4 -4
- package/dist/chain.d.ts +1 -1
- package/dist/chain.js +57 -54
- package/dist/channels.d.ts +26 -5
- package/dist/channels.js +12 -8
- package/dist/clock.d.ts +8 -1
- package/dist/clock.js +14 -3
- package/dist/clone.d.ts +3 -0
- package/dist/clone.js +16 -1
- package/dist/closed.d.ts +1 -1
- package/dist/closed.js +3 -2
- package/dist/color.d.ts +0 -11
- package/dist/color.js +4 -24
- package/dist/columns.js +0 -1
- package/dist/copyout.d.ts +6 -0
- package/dist/copyout.js +38 -0
- package/dist/crowd.d.ts +7 -5
- package/dist/crowd.js +32 -18
- package/dist/cue.d.ts +3 -1
- package/dist/cue.js +31 -20
- package/dist/departed.d.ts +34 -0
- package/dist/departed.js +73 -0
- package/dist/easing.d.ts +5 -0
- package/dist/easing.js +31 -2
- package/dist/everyone.d.ts +56 -0
- package/dist/everyone.js +221 -0
- package/dist/fade.d.ts +8 -1
- package/dist/fade.js +34 -6
- package/dist/fill.d.ts +22 -13
- package/dist/fill.js +104 -41
- package/dist/fit.js +2 -1
- package/dist/fold.d.ts +37 -0
- package/dist/fold.js +213 -28
- package/dist/gather.d.ts +15 -9
- package/dist/gather.js +60 -25
- package/dist/gone.js +10 -0
- package/dist/handle.d.ts +16 -5
- package/dist/handle.js +56 -6
- package/dist/held.d.ts +8 -5
- package/dist/held.js +56 -58
- package/dist/history.d.ts +17 -13
- package/dist/history.js +47 -28
- package/dist/hosts.js +55 -8
- package/dist/index.d.ts +9 -4
- package/dist/index.js +5 -2
- package/dist/keyfill.d.ts +7 -0
- package/dist/keyfill.js +124 -0
- package/dist/keyrows.d.ts +1 -0
- package/dist/keyrows.js +1 -1
- package/dist/lane.d.ts +32 -2
- package/dist/lane.js +5 -0
- package/dist/lanes.d.ts +32 -8
- package/dist/lanes.js +69 -37
- package/dist/leavings.d.ts +26 -0
- package/dist/leavings.js +70 -0
- package/dist/meet.js +14 -8
- package/dist/mixer.d.ts +39 -7
- package/dist/mixer.js +50 -10
- package/dist/motion.d.ts +2 -0
- package/dist/motion.js +4 -1
- package/dist/motions.d.ts +22 -15
- package/dist/motions.js +40 -34
- package/dist/move.js +23 -16
- package/dist/moved.d.ts +11 -0
- package/dist/moved.js +29 -0
- package/dist/origin.d.ts +19 -0
- package/dist/origin.js +68 -0
- package/dist/owed.d.ts +4 -4
- package/dist/owed.js +8 -8
- package/dist/owner.d.ts +1 -1
- package/dist/owner.js +2 -2
- package/dist/pace.d.ts +13 -5
- package/dist/pace.js +21 -8
- package/dist/pack.d.ts +3 -1
- package/dist/pack.js +15 -24
- package/dist/paging.d.ts +8 -2
- package/dist/paging.js +44 -4
- package/dist/patch.d.ts +14 -9
- package/dist/patch.js +83 -21
- package/dist/place.js +18 -3
- package/dist/project.d.ts +12 -1
- package/dist/project.js +101 -83
- package/dist/pull.d.ts +2 -0
- package/dist/pull.js +8 -0
- package/dist/qualify.js +10 -2
- package/dist/reading.d.ts +5 -0
- package/dist/reading.js +5 -0
- package/dist/record.d.ts +9 -0
- package/dist/record.js +42 -0
- package/dist/relink.d.ts +11 -5
- package/dist/relink.js +7 -5
- package/dist/restored.d.ts +41 -0
- package/dist/restored.js +91 -0
- package/dist/revive.d.ts +10 -3
- package/dist/revive.js +31 -23
- package/dist/roster.d.ts +11 -0
- package/dist/roster.js +46 -0
- package/dist/rotation.d.ts +29 -0
- package/dist/rotation.js +91 -0
- package/dist/rows.d.ts +5 -5
- package/dist/rows.js +5 -5
- package/dist/sample.d.ts +3 -2
- package/dist/sample.js +32 -15
- package/dist/seek.js +97 -114
- package/dist/shared.d.ts +6 -0
- package/dist/shared.js +15 -0
- package/dist/signals.d.ts +24 -3
- package/dist/signals.js +50 -11
- package/dist/spans.js +7 -0
- package/dist/stack.d.ts +11 -0
- package/dist/stack.js +47 -0
- package/dist/standing.d.ts +10 -0
- package/dist/standing.js +79 -0
- package/dist/store.d.ts +3 -3
- package/dist/store.js +3 -3
- package/dist/strays.js +3 -0
- package/dist/tape.d.ts +8 -5
- package/dist/tape.js +21 -13
- package/dist/testing.d.ts +35 -0
- package/dist/testing.js +116 -0
- package/dist/touch.d.ts +6 -0
- package/dist/touch.js +28 -0
- package/dist/transport.d.ts +49 -6
- package/dist/transport.js +89 -19
- package/dist/turns.d.ts +18 -0
- package/dist/turns.js +72 -0
- package/dist/tweened.js +1 -1
- package/dist/types/channel.d.ts +46 -0
- package/dist/types/channel.js +1 -0
- package/dist/types/history.d.ts +139 -0
- package/dist/types/history.js +1 -0
- package/dist/types/mix.d.ts +336 -0
- package/dist/types/mix.js +1 -0
- package/dist/types/patch.d.ts +187 -0
- package/dist/types/patch.js +1 -0
- package/dist/types/place.d.ts +157 -0
- package/dist/types/place.js +1 -0
- package/dist/types/transport.d.ts +71 -0
- package/dist/types/transport.js +1 -0
- package/dist/types/voice.d.ts +323 -0
- package/dist/types/voice.js +1 -0
- package/dist/types.d.ts +7 -1162
- package/dist/unpage.d.ts +2 -2
- package/dist/unpage.js +53 -25
- package/dist/voice.d.ts +90 -22
- package/dist/voice.js +105 -43
- package/dist/wave.d.ts +42 -0
- package/dist/wave.js +62 -0
- package/dist/weigh.js +1 -1
- package/docs/schema.html +42 -36
- package/package.json +8 -3
package/dist/unpage.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ import type { Transport } from './transport.js';
|
|
|
4
4
|
* it took records from the store. Throws before anything moves where it cannot.
|
|
5
5
|
*/
|
|
6
6
|
export declare function cover(transport: Transport, t: number): boolean;
|
|
7
|
-
/** A seek back to `
|
|
8
|
-
export declare function cut(transport: Transport,
|
|
7
|
+
/** A seek back to frame `seq`: what the store and `prepare` hold after it is from a future the tape makes again. */
|
|
8
|
+
export declare function cut(transport: Transport, seq: number, unpaged: boolean): void;
|
package/dist/unpage.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Leavings } from './leavings.js';
|
|
1
2
|
import { unpackHeld } from './pack.js';
|
|
2
3
|
import { HistoryMiss } from './paging.js';
|
|
3
4
|
import { reviveVoice } from './revive.js';
|
|
@@ -28,24 +29,25 @@ export function cover(transport, t) {
|
|
|
28
29
|
transport.floor = loaded.t;
|
|
29
30
|
return true;
|
|
30
31
|
}
|
|
31
|
-
/** A seek back to `
|
|
32
|
-
export function cut(transport,
|
|
32
|
+
/** A seek back to frame `seq`: what the store and `prepare` hold after it is from a future the tape makes again. */
|
|
33
|
+
export function cut(transport, seq, unpaged) {
|
|
33
34
|
const pager = transport.pager;
|
|
34
35
|
if (pager === null)
|
|
35
36
|
return;
|
|
36
37
|
if (unpaged)
|
|
37
|
-
pager.store.cut(
|
|
38
|
+
pager.store.cut(seq);
|
|
38
39
|
const loaded = pager.loaded;
|
|
39
40
|
if (loaded !== null)
|
|
40
|
-
loaded.records = loaded.records.filter((r) => r.
|
|
41
|
+
loaded.records = loaded.records.filter((r) => r.seq <= seq);
|
|
41
42
|
}
|
|
42
43
|
/** Puts records a store gave back into memory ahead of what it still holds, as if never paged. */
|
|
43
44
|
function unpage(transport, records) {
|
|
45
|
+
unpageTransport(transport, records);
|
|
44
46
|
const mixes = new Map();
|
|
45
47
|
for (const m of [...transport.members, ...transport.dropped.map((d) => d.mix)])
|
|
46
48
|
mixes.set(m.name ?? '', m);
|
|
47
49
|
const by = new Map();
|
|
48
|
-
for (const r of [...records].sort((a, b) => a.
|
|
50
|
+
for (const r of [...records].sort((a, b) => a.seq - b.seq)) {
|
|
49
51
|
const m = mixes.get(r.mix);
|
|
50
52
|
if (m === undefined)
|
|
51
53
|
continue;
|
|
@@ -58,6 +60,23 @@ function unpage(transport, records) {
|
|
|
58
60
|
for (const [m, list] of by)
|
|
59
61
|
unpageMix(m, list);
|
|
60
62
|
}
|
|
63
|
+
/** The transport's own records: its rate changes, the frames it played and the marks announced on it. */
|
|
64
|
+
function unpageTransport(transport, records) {
|
|
65
|
+
const own = records.filter((r) => r.mix === '' && r.voice === undefined);
|
|
66
|
+
const paces = own.filter((r) => r.stream === 'pace').map((r) => r.data);
|
|
67
|
+
if (paces.length > 0)
|
|
68
|
+
transport.pace?.unshed(paces);
|
|
69
|
+
const frames = own
|
|
70
|
+
.filter((r) => r.stream === 'frame')
|
|
71
|
+
.map((r) => ({ seq: r.seq, at: r.at, u: r.data }));
|
|
72
|
+
transport.frames = before(frames, transport.frames);
|
|
73
|
+
const held = new Set(transport.announced.map((a) => a.order));
|
|
74
|
+
const marks = own
|
|
75
|
+
.filter((r) => r.stream === 'mark' && !held.has(r.data.order))
|
|
76
|
+
.map((r) => r.data);
|
|
77
|
+
if (marks.length > 0)
|
|
78
|
+
transport.announced = [...marks, ...transport.announced].sort((a, b) => a.order - b.order);
|
|
79
|
+
}
|
|
61
80
|
function unpageMix(mix, records) {
|
|
62
81
|
const voices = new Map();
|
|
63
82
|
for (const v of [...mix.cued, ...mix.gone])
|
|
@@ -70,7 +89,7 @@ function unpageMix(mix, records) {
|
|
|
70
89
|
scoredLeft(mix, v);
|
|
71
90
|
}
|
|
72
91
|
const host = records.filter((r) => r.stream === 'host');
|
|
73
|
-
mix.hostLog = before(host.map((r) => ({ at: r.at, fields: r.data })), mix.hostLog);
|
|
92
|
+
mix.hostLog = before(host.map((r) => ({ at: r.at, seq: r.seq, fields: r.data })), mix.hostLog);
|
|
74
93
|
const byVoice = new Map();
|
|
75
94
|
for (const r of records) {
|
|
76
95
|
if (r.voice === undefined)
|
|
@@ -92,29 +111,38 @@ function unpageVoice(voice, records, keys) {
|
|
|
92
111
|
const of = (stream) => records.filter((r) => r.stream === stream);
|
|
93
112
|
if (voice.log !== null)
|
|
94
113
|
voice.log = before(of('controls').map((r) => r.data), voice.log);
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
114
|
+
const paged = of('left');
|
|
115
|
+
if (paged.length > 0) {
|
|
116
|
+
const left = [...(voice.left?.all() ?? [])];
|
|
117
|
+
for (const r of paged) {
|
|
118
|
+
const subject = keys.subject(r.subject);
|
|
119
|
+
if (left.some((e) => e.seq === r.seq && Object.is(e.subject, subject)))
|
|
120
|
+
continue;
|
|
121
|
+
const [p, sync] = r.data;
|
|
122
|
+
left.push({ subject, at: r.at, seq: r.seq, sync, held: unpackHeld(voice, p) });
|
|
123
|
+
}
|
|
124
|
+
left.sort((a, b) => a.seq - b.seq);
|
|
125
|
+
voice.left = Leavings.from(left);
|
|
100
126
|
}
|
|
101
|
-
left.sort((a, b) => a.at - b.at);
|
|
102
|
-
voice.left = left.length === 0 ? null : left;
|
|
103
127
|
for (const [key, list] of bySubject(of('snap'))) {
|
|
104
128
|
const subject = keys.subject(key);
|
|
105
129
|
for (const [held, snaps] of lives(voice, subject, list))
|
|
106
|
-
held.snaps = before(snaps.map((r) => ({
|
|
130
|
+
held.snaps = before(snaps.map((r) => ({
|
|
131
|
+
at: r.at,
|
|
132
|
+
seq: r.seq,
|
|
133
|
+
held: unpackHeld(voice, r.data),
|
|
134
|
+
})), held.snaps ?? []);
|
|
107
135
|
}
|
|
108
136
|
for (const [key, list] of bySubject(of('input'))) {
|
|
109
137
|
const subject = keys.subject(key);
|
|
110
138
|
for (const [held, inputs] of lives(voice, subject, list))
|
|
111
|
-
held.inputs = before(inputs.map((r) => ({ at: r.at, value: r.data })), held.inputs ?? []);
|
|
139
|
+
held.inputs = before(inputs.map((r) => ({ at: r.at, seq: r.seq, value: r.data })), held.inputs ?? []);
|
|
112
140
|
}
|
|
113
141
|
const motion = voice.motion;
|
|
114
142
|
if (motion === undefined)
|
|
115
143
|
return;
|
|
116
144
|
for (const r of of('released'))
|
|
117
|
-
motion.reclaim(keys.subject(r.subject), r.at, r.data);
|
|
145
|
+
motion.reclaim(keys.subject(r.subject), r.at, r.seq, r.data);
|
|
118
146
|
for (const [key, list] of bySubject(of('stretch')))
|
|
119
147
|
motion.restretch(keys.subject(key), list);
|
|
120
148
|
}
|
|
@@ -134,29 +162,29 @@ function bySubject(records) {
|
|
|
134
162
|
* subject leaves the voice, and the record it has now began after its last leaving.
|
|
135
163
|
*/
|
|
136
164
|
function lives(voice, subject, records) {
|
|
137
|
-
const left =
|
|
165
|
+
const left = voice.left?.of(subject) ?? [];
|
|
138
166
|
const out = [];
|
|
139
167
|
let from = Number.NEGATIVE_INFINITY;
|
|
140
168
|
for (const e of left) {
|
|
141
|
-
out.push([e.held, records.filter((r) => r.
|
|
142
|
-
from = e.
|
|
169
|
+
out.push([e.held, records.filter((r) => r.seq > from && r.seq <= e.seq)]);
|
|
170
|
+
from = e.seq;
|
|
143
171
|
}
|
|
144
172
|
const live = voice.subjects.get(subject);
|
|
145
173
|
if (live?.reaches)
|
|
146
|
-
out.push([live, records.filter((r) => r.
|
|
174
|
+
out.push([live, records.filter((r) => r.seq > from)]);
|
|
147
175
|
return out;
|
|
148
176
|
}
|
|
149
177
|
/**
|
|
150
|
-
* `loaded`, in
|
|
151
|
-
* share a
|
|
178
|
+
* `loaded`, in the order it was made, ahead of `list`: those older than its first entry, the last
|
|
179
|
+
* of any that share a frame, which is the one a read finds.
|
|
152
180
|
*/
|
|
153
181
|
function before(loaded, list) {
|
|
154
|
-
const first = list[0]?.
|
|
182
|
+
const first = list[0]?.seq ?? Number.POSITIVE_INFINITY;
|
|
155
183
|
const out = [];
|
|
156
184
|
for (const e of loaded) {
|
|
157
|
-
if (!(e.
|
|
185
|
+
if (!(e.seq < first))
|
|
158
186
|
continue;
|
|
159
|
-
if (out.length > 0 && out[out.length - 1].
|
|
187
|
+
if (out.length > 0 && out[out.length - 1].seq === e.seq)
|
|
160
188
|
out[out.length - 1] = e;
|
|
161
189
|
else
|
|
162
190
|
out.push(e);
|
package/dist/voice.d.ts
CHANGED
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
import type { Blend } from './blend.js';
|
|
2
2
|
import { type Clock } from './clock.js';
|
|
3
3
|
import { type Curve } from './easing.js';
|
|
4
|
+
import type { Leavings } from './leavings.js';
|
|
4
5
|
import type { Motions } from './motions.js';
|
|
5
6
|
import { Named } from './named.js';
|
|
7
|
+
import type { Past } from './origin.js';
|
|
6
8
|
import { Holding } from './owner.js';
|
|
7
9
|
import { type Built, intosOf, type Scratch } from './patch.js';
|
|
8
10
|
import type { Fitting } from './spans.js';
|
|
9
11
|
import { Store } from './store.js';
|
|
10
12
|
import type { Anchor, Channel, FadeSpec, Handle, Patch, Setting, VoiceSpec } from './types.js';
|
|
13
|
+
/**
|
|
14
|
+
* A subject's record as it left a voice, faded out of it or dropped: the mix time and frame it
|
|
15
|
+
* left at, and `sync` where the frame's sync made it, before the frame was read.
|
|
16
|
+
*/
|
|
17
|
+
export interface Left<I> {
|
|
18
|
+
subject: I;
|
|
19
|
+
at: number;
|
|
20
|
+
seq: number;
|
|
21
|
+
sync: boolean;
|
|
22
|
+
held: Subject<unknown>;
|
|
23
|
+
}
|
|
11
24
|
export declare const none: readonly string[];
|
|
12
25
|
/** Everything one voice holds for one subject, chained through the next voice that reaches it. */
|
|
13
26
|
export interface Subject<S> {
|
|
@@ -41,6 +54,8 @@ export interface Subject<S> {
|
|
|
41
54
|
phase: number;
|
|
42
55
|
/** The voice's `seeks` when `delta` was read, so a seek later in the frame reads it again. */
|
|
43
56
|
seeks: number;
|
|
57
|
+
/** The voice's `rebuilds` when its state was last made, so a seek's rebuild reaches it once. */
|
|
58
|
+
rebuilt: number;
|
|
44
59
|
/** Stop 0 for a `from: 'current'` voice, taken the first frame this subject is seen. */
|
|
45
60
|
base?: Record<string, unknown>;
|
|
46
61
|
/** The pose's velocity per channel at that moment, units per ms, so the first segment leaves at it. */
|
|
@@ -52,6 +67,7 @@ export interface Subject<S> {
|
|
|
52
67
|
/** Under `history`, copies of this record by the mix time they were taken, oldest first. */
|
|
53
68
|
snaps?: {
|
|
54
69
|
at: number;
|
|
70
|
+
seq: number;
|
|
55
71
|
held: Subject<S>;
|
|
56
72
|
}[];
|
|
57
73
|
/** In a projection: where this record started from, and whether nothing known could be. */
|
|
@@ -60,6 +76,7 @@ export interface Subject<S> {
|
|
|
60
76
|
/** Under `history` with `inputs`, what an input weight signal read for this subject, when it changed. */
|
|
61
77
|
inputs?: {
|
|
62
78
|
at: number;
|
|
79
|
+
seq: number;
|
|
63
80
|
value: number;
|
|
64
81
|
}[];
|
|
65
82
|
/** In a projection reading back: that record, to read in place of the signal. */
|
|
@@ -80,10 +97,15 @@ export interface Subject<S> {
|
|
|
80
97
|
loci: Map<string, Uint8Array> | null;
|
|
81
98
|
/** On the first record: the number lanes index this subject by, -1 without one. */
|
|
82
99
|
slot: number;
|
|
100
|
+
/** A motion voice's number for this subject in its patch, good while `freed` is the patch's own. */
|
|
101
|
+
run: number;
|
|
102
|
+
freed: number;
|
|
83
103
|
}
|
|
84
104
|
/** A voice's clock, weight and fade from one mix time on, kept under `history`. */
|
|
85
105
|
export interface Controls extends Clock {
|
|
86
106
|
at: number;
|
|
107
|
+
/** The frame it was made in. */
|
|
108
|
+
seq: number;
|
|
87
109
|
weight: number;
|
|
88
110
|
out: Ramp | null;
|
|
89
111
|
back: Rise | null;
|
|
@@ -93,7 +115,10 @@ export interface Controls extends Clock {
|
|
|
93
115
|
/** A fade the host set for `outAt`: its ramp, NaN for the voice's own `fade.out`. */
|
|
94
116
|
outOver: number;
|
|
95
117
|
outSet: boolean;
|
|
96
|
-
|
|
118
|
+
rebuilds: number;
|
|
119
|
+
/** How many of the voice's past clocks it had then. */
|
|
120
|
+
past: number;
|
|
121
|
+
/** Shows in its own frame: made by a sync, or before anything read the mix that frame. */
|
|
97
122
|
sync: boolean;
|
|
98
123
|
}
|
|
99
124
|
export interface Ramp {
|
|
@@ -158,26 +183,39 @@ export declare class Voice<I, O> {
|
|
|
158
183
|
holder: Subject<unknown> | null;
|
|
159
184
|
/** Whether its channels run as lanes this frame, so the general fold passes it by. */
|
|
160
185
|
laned: boolean;
|
|
161
|
-
/**
|
|
186
|
+
/**
|
|
187
|
+
* How many times it has been sought or touched, so a delta read before either is not handed out
|
|
188
|
+
* after it.
|
|
189
|
+
*/
|
|
162
190
|
seeks: number;
|
|
191
|
+
/** Whether the host has written to its handle, so it no longer plays as it was cued. */
|
|
192
|
+
written: boolean;
|
|
193
|
+
/** How many of `seeks` were the mix's `touch`, which moves no clock. */
|
|
194
|
+
touches: number;
|
|
195
|
+
/** How many times its clock has jumped, which a booker counts hits again from. */
|
|
196
|
+
get jumps(): number;
|
|
197
|
+
/** Seeks that rebuild state; a record stamped with fewer makes its state again before stepping. */
|
|
198
|
+
rebuilds: number;
|
|
199
|
+
/** Whether its span's last fit jumped it to its end, which leaves it no time in that fit. */
|
|
200
|
+
skipped: boolean;
|
|
163
201
|
/** Whether its patch has kept state on a record through `setting.keep`, which makes it stateful. */
|
|
164
202
|
keeping: boolean;
|
|
165
203
|
/** Subjects fading out of this voice alone, by the ramp each started; null while none are. */
|
|
166
204
|
parts: Map<I, {
|
|
167
205
|
at: number;
|
|
168
206
|
over: number;
|
|
207
|
+
seq: number;
|
|
208
|
+
}> | null;
|
|
209
|
+
/** Subjects faded out of this voice, by the mix time and frame each left at; null while none have. */
|
|
210
|
+
parted: Map<I, {
|
|
211
|
+
at: number;
|
|
212
|
+
seq: number;
|
|
169
213
|
}> | null;
|
|
170
|
-
/** Subjects faded out of this voice, by the mix time each left at; null while none have. */
|
|
171
|
-
parted: Map<I, number> | null;
|
|
172
214
|
/**
|
|
173
|
-
* Under history, the records of subjects that left this voice, by the mix time
|
|
174
|
-
* while a seek or a read back may reach them; null while none have.
|
|
215
|
+
* Under history, the records of subjects that left this voice, by the mix time and frame each
|
|
216
|
+
* left at, while a seek or a read back may reach them; null while none have.
|
|
175
217
|
*/
|
|
176
|
-
left:
|
|
177
|
-
subject: I;
|
|
178
|
-
at: number;
|
|
179
|
-
held: Subject<unknown>;
|
|
180
|
-
}[] | null;
|
|
218
|
+
left: Leavings<I> | null;
|
|
181
219
|
readonly ease: Curve | undefined;
|
|
182
220
|
/** How many passes its `loop` plays, worked out once. */
|
|
183
221
|
readonly passes: number;
|
|
@@ -193,8 +231,13 @@ export declare class Voice<I, O> {
|
|
|
193
231
|
opened: number;
|
|
194
232
|
/** Which of its entries in the mix's due queue is current; older ones are skipped when popped. */
|
|
195
233
|
dueToken: number;
|
|
196
|
-
/**
|
|
234
|
+
/**
|
|
235
|
+
* Records whose `since` was still ahead when last worked out, which a later start, rate change
|
|
236
|
+
* or seek moves; null while none are.
|
|
237
|
+
*/
|
|
197
238
|
early: Subject<unknown>[] | null;
|
|
239
|
+
/** The clocks it ran on before its current one, where a subject's origin may lie; null for none. */
|
|
240
|
+
clocks: Past[] | null;
|
|
198
241
|
/** Reused for every call this voice makes, so it is valid only during the call. */
|
|
199
242
|
readonly setting: Setting<unknown>;
|
|
200
243
|
/** Every subject this voice has been asked about, so a handover knows when it is finished. */
|
|
@@ -204,8 +247,12 @@ export declare class Voice<I, O> {
|
|
|
204
247
|
restedCount: number;
|
|
205
248
|
/** The mix time it was cued at; -Infinity before the first sync. */
|
|
206
249
|
cuedAt: number;
|
|
207
|
-
/** The
|
|
250
|
+
/** The frame it was cued in. */
|
|
251
|
+
cuedSeq: number;
|
|
252
|
+
/** The mix time it left at, which a fade or seek given a time already passed puts behind now. */
|
|
208
253
|
doneAt: number;
|
|
254
|
+
/** The frame its leaving was decided in, which a seek or read back partitions by. */
|
|
255
|
+
doneSeq: number;
|
|
209
256
|
/** Under `history`, its controls after each change, oldest first. */
|
|
210
257
|
log: Controls[] | null;
|
|
211
258
|
/** Under `history`, its controls as `cue` left them, which a voice parked by a seek takes back. */
|
|
@@ -237,6 +284,20 @@ export declare class Voice<I, O> {
|
|
|
237
284
|
unreached: Subject<unknown> | null;
|
|
238
285
|
/** By subject number, a bit set where `unreached` stands for the subject; null until one is. */
|
|
239
286
|
unreachedBits: Uint32Array | null;
|
|
287
|
+
/** Whether one record stands for every subject: see `shares` in `everyone.ts`. */
|
|
288
|
+
sharing: boolean;
|
|
289
|
+
/** That record, null until a chain first asks and once the voice shares no more. */
|
|
290
|
+
everyone: Subject<unknown> | null;
|
|
291
|
+
/** While sharing, by subject number: a bit where a chain has asked about the subject. */
|
|
292
|
+
sighted: Uint32Array | null;
|
|
293
|
+
/** While sharing, by subject number: the weight last given the subject on the general path. */
|
|
294
|
+
weights: Float64Array | null;
|
|
295
|
+
/**
|
|
296
|
+
* While sharing a patch that is called, by subject number: when it was last called for the
|
|
297
|
+
* subject and at what `seeks`, side by side, and the delta that call gave.
|
|
298
|
+
*/
|
|
299
|
+
stamps: Float64Array | null;
|
|
300
|
+
deltas: (Record<string, unknown> | null)[] | null;
|
|
240
301
|
/** The handle `cue` returned, which `voices` hands back too. */
|
|
241
302
|
handle: Handle<I> | null;
|
|
242
303
|
/** With a history store, the key of every subject it has a record of; null without one. */
|
|
@@ -251,8 +312,10 @@ export declare class Voice<I, O> {
|
|
|
251
312
|
*/
|
|
252
313
|
private finished;
|
|
253
314
|
private playedAs;
|
|
254
|
-
/** The mix time `played` was settled at
|
|
315
|
+
/** The mix time `played` was settled at. */
|
|
255
316
|
private playedAt;
|
|
317
|
+
/** The frame `played` was settled in, so a seek back to before it can open it again. */
|
|
318
|
+
private playedSeq;
|
|
256
319
|
private donePromise;
|
|
257
320
|
private doneSettle;
|
|
258
321
|
private playedPromise;
|
|
@@ -267,21 +330,24 @@ export declare class Voice<I, O> {
|
|
|
267
330
|
* Its finite loop ended (true) or it left first (false), whichever comes first, noticed at mix
|
|
268
331
|
* time `at`: `played` resolves.
|
|
269
332
|
*/
|
|
270
|
-
play(played: boolean, at: number): void;
|
|
271
|
-
/** How `played` settled, and the mix time it did; undefined while it has not. */
|
|
333
|
+
play(played: boolean, at: number, seq: number): void;
|
|
334
|
+
/** How `played` settled, and the mix time and frame it did; undefined while it has not. */
|
|
272
335
|
get settled(): {
|
|
273
336
|
played: boolean | undefined;
|
|
274
337
|
at: number;
|
|
338
|
+
seq: number;
|
|
275
339
|
};
|
|
276
340
|
/** Whether `played` settled true, which its owner counted. */
|
|
277
341
|
get passed(): boolean;
|
|
278
342
|
/** Whether `played` settled false: it left before its last pass ended. */
|
|
279
343
|
get unplayed(): boolean;
|
|
280
344
|
/**
|
|
281
|
-
* A seek back to
|
|
345
|
+
* A seek back to frame `seq`: `done` and `played`, where they settled after it, start over with
|
|
282
346
|
* fresh promises. True where `played` had settled true, which its owner counted.
|
|
283
347
|
*/
|
|
284
|
-
reopen(
|
|
348
|
+
reopen(seq: number): boolean;
|
|
349
|
+
/** Takes on a set of controls: its clock, weight, fades and where its anchors put it. */
|
|
350
|
+
take(c: Omit<Controls, 'at' | 'seq' | 'sync'>): void;
|
|
285
351
|
/**
|
|
286
352
|
* A seek back to before its cue: out of the mix, as `cue` left it, until the mix plays the cue
|
|
287
353
|
* again. What it played since is forgotten, and `done` and `played` start over where they had
|
|
@@ -295,13 +361,15 @@ export declare class Voice<I, O> {
|
|
|
295
361
|
elapsedAt(now: number): number;
|
|
296
362
|
/** The mix time its clock reads `elapsed`, inverting `elapsedAt`; Infinity where it never will. */
|
|
297
363
|
timeAt(elapsed: number): number;
|
|
298
|
-
/** Records this voice's controls as they stand, from mix time `at`. */
|
|
299
|
-
note(at: number, sync?: boolean): void;
|
|
364
|
+
/** Records this voice's controls as they stand, from mix time `at` in frame `seq`. */
|
|
365
|
+
note(at: number, seq: number, sync?: boolean): void;
|
|
300
366
|
/**
|
|
301
367
|
* A copy for a projection: its own setting, which sends nothing, and its own per-subject records,
|
|
302
|
-
* filled from `fill`. With `controls` it takes those, as the voice stood at an earlier time.
|
|
368
|
+
* filled from `fill`. With `controls` it takes those, as the voice stood at an earlier time. With
|
|
369
|
+
* `share`, a voice keeping one record for every subject gives its copy a copy of that one, which
|
|
370
|
+
* a read ahead starts every subject from; `fill` then serves only a copy that shares no more.
|
|
303
371
|
*/
|
|
304
|
-
copy(fill: (subject: I) => Subject<unknown> | undefined, controls?: Controls): Voice<I, O>;
|
|
372
|
+
copy(fill: (subject: I) => Subject<unknown> | undefined, controls?: Controls, share?: boolean): Voice<I, O>;
|
|
305
373
|
rateAt(now: number): number;
|
|
306
374
|
/** Moves the anchor to `now`, carrying what is left of a ramp. */
|
|
307
375
|
rebase(now: number): void;
|