@msb235/blits 0.6.0 → 0.7.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 +152 -0
- package/README.md +31 -7
- package/dist/bare.js +7 -1
- package/dist/book.d.ts +7 -0
- package/dist/book.js +35 -4
- package/dist/chain.d.ts +2 -1
- package/dist/chain.js +7 -3
- package/dist/channels.d.ts +12 -19
- package/dist/channels.js +18 -118
- package/dist/clock.d.ts +9 -2
- package/dist/clock.js +10 -2
- package/dist/closed.d.ts +15 -0
- package/dist/closed.js +144 -0
- package/dist/color.d.ts +61 -0
- package/dist/color.js +229 -0
- package/dist/columns.js +2 -1
- package/dist/crowd.d.ts +1 -1
- package/dist/crowd.js +4 -1
- package/dist/cue.d.ts +2 -0
- package/dist/cue.js +80 -27
- package/dist/due.js +3 -0
- package/dist/fade.d.ts +13 -0
- package/dist/fade.js +57 -4
- package/dist/fill.d.ts +1 -1
- package/dist/fill.js +15 -8
- package/dist/fit.d.ts +144 -0
- package/dist/fit.js +181 -0
- package/dist/fold.d.ts +3 -3
- package/dist/fold.js +18 -11
- package/dist/gather.d.ts +6 -0
- package/dist/gather.js +18 -0
- package/dist/gone.d.ts +32 -0
- package/dist/gone.js +134 -0
- package/dist/handle.d.ts +27 -2
- package/dist/handle.js +60 -11
- package/dist/held.js +4 -0
- package/dist/history.d.ts +15 -2
- package/dist/history.js +56 -9
- package/dist/hosts.d.ts +2 -2
- package/dist/hosts.js +20 -6
- package/dist/index.d.ts +8 -2
- package/dist/index.js +5 -1
- package/dist/lane.d.ts +1 -1
- package/dist/lanes.d.ts +32 -9
- package/dist/lanes.js +53 -24
- package/dist/locus.d.ts +3 -3
- package/dist/locus.js +1 -1
- package/dist/marks.d.ts +3 -0
- package/dist/marks.js +80 -12
- package/dist/meet.d.ts +3 -2
- package/dist/meet.js +15 -3
- package/dist/mixer.d.ts +56 -36
- package/dist/mixer.js +158 -87
- package/dist/motion.d.ts +2 -199
- package/dist/motion.js +2 -652
- package/dist/motions.d.ts +266 -0
- package/dist/motions.js +724 -0
- package/dist/move.d.ts +1 -1
- package/dist/move.js +28 -8
- package/dist/owner.d.ts +1 -1
- package/dist/owner.js +3 -3
- package/dist/pace.d.ts +2 -0
- package/dist/pace.js +8 -0
- package/dist/pack.d.ts +31 -0
- package/dist/pack.js +65 -0
- package/dist/paging.d.ts +63 -0
- package/dist/paging.js +110 -0
- package/dist/patch.d.ts +3 -0
- package/dist/patch.js +2 -0
- package/dist/place.js +235 -43
- package/dist/project.d.ts +7 -4
- package/dist/project.js +117 -78
- package/dist/pull.js +4 -3
- package/dist/qualify.js +4 -2
- package/dist/revive.d.ts +58 -0
- package/dist/revive.js +158 -0
- package/dist/sample.d.ts +1 -1
- package/dist/sample.js +6 -1
- package/dist/scored.d.ts +57 -0
- package/dist/scored.js +196 -0
- package/dist/seek.d.ts +3 -0
- package/dist/seek.js +311 -0
- package/dist/spans.d.ts +29 -0
- package/dist/spans.js +165 -0
- package/dist/strays.d.ts +1 -1
- package/dist/strays.js +21 -0
- package/dist/tape.d.ts +21 -0
- package/dist/tape.js +65 -0
- package/dist/ticker.d.ts +28 -3
- package/dist/ticker.js +3 -0
- package/dist/transport.d.ts +125 -0
- package/dist/transport.js +283 -0
- package/dist/types.d.ts +404 -38
- package/dist/unpage.d.ts +8 -0
- package/dist/unpage.js +165 -0
- package/dist/voice.d.ts +75 -7
- package/dist/voice.js +119 -4
- package/dist/weigh.js +2 -2
- package/docs/schema.html +120 -31
- package/package.json +2 -1
package/dist/lanes.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Column } from './columns.js';
|
|
2
2
|
import { type Crowd, row } from './crowd.js';
|
|
3
3
|
import { call, foldKeys, one, parting, readKeyed, reset, run, signalled, subjectAt } from './fill.js';
|
|
4
|
-
import { fold, foldDelta, foldInto, foldRun, gather } from './gather.js';
|
|
4
|
+
import { fold, foldDelta, foldInto, foldRun, gate, gather } from './gather.js';
|
|
5
5
|
import { type Lane, type Laned, type Locus } from './lane.js';
|
|
6
|
-
import type { Watcher } from './
|
|
6
|
+
import type { Watcher } from './motions.js';
|
|
7
7
|
import { type absent, Numbers } from './numbers.js';
|
|
8
8
|
import { Owed } from './owed.js';
|
|
9
9
|
import type { Channel } from './types.js';
|
|
@@ -13,6 +13,10 @@ export interface LaneHost<I, O> {
|
|
|
13
13
|
readonly voices: readonly Voice<I, O>[];
|
|
14
14
|
readonly channels: readonly Channel<unknown>[];
|
|
15
15
|
readonly names: readonly string[];
|
|
16
|
+
/** The mix itself, for its clock: a getter V8 does not inline would box `now` on return. */
|
|
17
|
+
readonly clock: {
|
|
18
|
+
readonly now: number;
|
|
19
|
+
};
|
|
16
20
|
/** Whether a voice's patch and spec can run on a lane, its channels aside. */
|
|
17
21
|
fits(voice: Voice<I, O>): boolean;
|
|
18
22
|
/** The voice's record for a subject this probe has already linked it to, from `head` if there. */
|
|
@@ -35,12 +39,14 @@ export interface LaneHost<I, O> {
|
|
|
35
39
|
* stateful if the signal keeps state. `slot` is the subject's number.
|
|
36
40
|
*/
|
|
37
41
|
signal(voice: Voice<I, O>, subject: I, held: Subject<unknown>, elapsed: number, pass: number, slot: number): number;
|
|
42
|
+
/** Whether a rest-less channel's contribution passes the band, as the general path decides it. */
|
|
43
|
+
passes(was: boolean | undefined, w: number): boolean;
|
|
38
44
|
/** Sets `reading.horizon` for the voice and a subject delayed `delay` voice ms. */
|
|
39
45
|
horizon(voice: Voice<I, O>, delay: number): void;
|
|
40
46
|
/** Whether the mix keeps history, so a record a patch call changed may need a copy kept. */
|
|
41
47
|
readonly keeps: boolean;
|
|
42
48
|
/** After a patch call, keeps history of a record that grew kept state. */
|
|
43
|
-
after(voice: Voice<I, O>, held: Subject<unknown>): void;
|
|
49
|
+
after(voice: Voice<I, O>, subject: I, held: Subject<unknown>): void;
|
|
44
50
|
/** A patch call left kept state on a record: the voice is stateful from now on. */
|
|
45
51
|
kept(voice: Voice<I, O>): void;
|
|
46
52
|
}
|
|
@@ -62,6 +68,9 @@ export declare class Lanes<I, O> implements Watcher {
|
|
|
62
68
|
overlap: boolean;
|
|
63
69
|
/** The loci whose voices are on lanes, every member of each on one. */
|
|
64
70
|
loci: Locus<I, O>[];
|
|
71
|
+
/** The lane and record `one` is folding, whose band state a rest-less channel reads. */
|
|
72
|
+
folding: Lane<I, O> | null;
|
|
73
|
+
rec: Subject<unknown> | null;
|
|
65
74
|
/** While a fill gathers a locus: that locus and the member gathering, where folds go instead. */
|
|
66
75
|
into: Locus<I, O> | null;
|
|
67
76
|
intoId: number;
|
|
@@ -88,14 +97,17 @@ export declare class Lanes<I, O> implements Watcher {
|
|
|
88
97
|
/** The highest voice id the last qualify or settling of `touched` considered. */
|
|
89
98
|
known: number;
|
|
90
99
|
/**
|
|
91
|
-
* Per subject number, `SLOT` numbers side by side, so a probe reads one place in memory:
|
|
92
|
-
* fill last
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* the
|
|
100
|
+
* Per subject number, `SLOT` numbers side by side, so a probe reads one place in memory: the
|
|
101
|
+
* fill that last left it to the general path, being late, owing, newly numbered or forgotten;
|
|
102
|
+
* the latest lane epoch a probe of it has checked it against; how many idle lanes reach it,
|
|
103
|
+
* since a probe reads lanes only where none do; and the probe count at its last probe read from
|
|
104
|
+
* the lanes and at its last probe folded by the general path, with the fill the former read,
|
|
105
|
+
* which say whether a lane or a record holds what `weightOf` reports.
|
|
96
106
|
*/
|
|
97
107
|
per: Float64Array<ArrayBuffer>;
|
|
98
108
|
fills: number;
|
|
109
|
+
/** The latest fill if it ran a lane, else 0: a subject whose `FILLED` is below it reads it. */
|
|
110
|
+
busyFill: number;
|
|
99
111
|
probes: number;
|
|
100
112
|
/**
|
|
101
113
|
* Each subject by number as last probed, held from that probe until the next fill uses it, so a
|
|
@@ -140,6 +152,11 @@ export declare class Lanes<I, O> implements Watcher {
|
|
|
140
152
|
lastDistinct: number;
|
|
141
153
|
/** Numbered subjects alive. */
|
|
142
154
|
live: number;
|
|
155
|
+
/**
|
|
156
|
+
* The probe count a subject's last probe must pass for this fill to fill it: the start of the
|
|
157
|
+
* last frame with a probe, or -1 while every subject alive was probed then, when it fills all.
|
|
158
|
+
*/
|
|
159
|
+
lately: number;
|
|
143
160
|
filledVersion: number;
|
|
144
161
|
qualifiedVersion: number;
|
|
145
162
|
constructor(host: LaneHost<I, O>);
|
|
@@ -171,7 +188,7 @@ export declare class Lanes<I, O> implements Watcher {
|
|
|
171
188
|
* them. One that a lane has not met yet, newly numbered or newly reached, takes the general path
|
|
172
189
|
* this frame, which is where it is first seen; so does one probed from inside a fill.
|
|
173
190
|
*/
|
|
174
|
-
prepare(slot: number, subject: I,
|
|
191
|
+
prepare(slot: number, subject: I, version: number, head: Subject<unknown> | null): boolean;
|
|
175
192
|
/** Whether this frame's lanes are filled and nothing since asks `begin` to look again. */
|
|
176
193
|
filled(now: number, version: number): boolean;
|
|
177
194
|
/**
|
|
@@ -180,6 +197,11 @@ export declare class Lanes<I, O> implements Watcher {
|
|
|
180
197
|
*/
|
|
181
198
|
begin(now: number, version: number): number;
|
|
182
199
|
general(slot: number): false;
|
|
200
|
+
/**
|
|
201
|
+
* Whether this fill leaves the subject at `slot` to the general path, for not having been probed
|
|
202
|
+
* this frame or the last: a probe of it before the next fill then takes the general path.
|
|
203
|
+
*/
|
|
204
|
+
unread(slot: number): boolean;
|
|
183
205
|
/** Whether a probe has read the subject since the frame began, on either path. */
|
|
184
206
|
probedThisFrame(slot: number): boolean;
|
|
185
207
|
/** Whether the subject at `slot` reads some laned voice from the general path this fill. */
|
|
@@ -221,6 +243,7 @@ declare const methods: {
|
|
|
221
243
|
foldDelta: typeof foldDelta;
|
|
222
244
|
foldRun: typeof foldRun;
|
|
223
245
|
foldInto: typeof foldInto;
|
|
246
|
+
gate: typeof gate;
|
|
224
247
|
};
|
|
225
248
|
type Methods = typeof methods;
|
|
226
249
|
export interface Lanes<I, O> extends Methods {
|
package/dist/lanes.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { row } from './crowd.js';
|
|
2
2
|
import { call, fillAll, foldKeys, one, parting, readKeyed, reset, run, signalled, subjectAt, } from './fill.js';
|
|
3
|
-
import { fold, foldDelta, foldInto, foldRun, gather } from './gather.js';
|
|
4
|
-
import { meet,
|
|
3
|
+
import { fold, foldDelta, foldInto, foldRun, gate, gather } from './gather.js';
|
|
4
|
+
import { meet, reach } from './meet.js';
|
|
5
5
|
import { Numbers } from './numbers.js';
|
|
6
6
|
import { Owed } from './owed.js';
|
|
7
7
|
import { requalify, retouch } from './qualify.js';
|
|
@@ -26,6 +26,9 @@ export class Lanes {
|
|
|
26
26
|
overlap = false;
|
|
27
27
|
/** The loci whose voices are on lanes, every member of each on one. */
|
|
28
28
|
loci = [];
|
|
29
|
+
/** The lane and record `one` is folding, whose band state a rest-less channel reads. */
|
|
30
|
+
folding = null;
|
|
31
|
+
rec = null;
|
|
29
32
|
/** While a fill gathers a locus: that locus and the member gathering, where folds go instead. */
|
|
30
33
|
into = null;
|
|
31
34
|
intoId = 0;
|
|
@@ -52,14 +55,17 @@ export class Lanes {
|
|
|
52
55
|
/** The highest voice id the last qualify or settling of `touched` considered. */
|
|
53
56
|
known = 0;
|
|
54
57
|
/**
|
|
55
|
-
* Per subject number, `SLOT` numbers side by side, so a probe reads one place in memory:
|
|
56
|
-
* fill last
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* the
|
|
58
|
+
* Per subject number, `SLOT` numbers side by side, so a probe reads one place in memory: the
|
|
59
|
+
* fill that last left it to the general path, being late, owing, newly numbered or forgotten;
|
|
60
|
+
* the latest lane epoch a probe of it has checked it against; how many idle lanes reach it,
|
|
61
|
+
* since a probe reads lanes only where none do; and the probe count at its last probe read from
|
|
62
|
+
* the lanes and at its last probe folded by the general path, with the fill the former read,
|
|
63
|
+
* which say whether a lane or a record holds what `weightOf` reports.
|
|
60
64
|
*/
|
|
61
65
|
per = new Float64Array(0);
|
|
62
66
|
fills = 0;
|
|
67
|
+
/** The latest fill if it ran a lane, else 0: a subject whose `FILLED` is below it reads it. */
|
|
68
|
+
busyFill = 0;
|
|
63
69
|
probes = 0;
|
|
64
70
|
/**
|
|
65
71
|
* Each subject by number as last probed, held from that probe until the next fill uses it, so a
|
|
@@ -104,6 +110,11 @@ export class Lanes {
|
|
|
104
110
|
lastDistinct = 0;
|
|
105
111
|
/** Numbered subjects alive. */
|
|
106
112
|
live = 0;
|
|
113
|
+
/**
|
|
114
|
+
* The probe count a subject's last probe must pass for this fill to fill it: the start of the
|
|
115
|
+
* last frame with a probe, or -1 while every subject alive was probed then, when it fills all.
|
|
116
|
+
*/
|
|
117
|
+
lately = -1;
|
|
107
118
|
filledVersion = Number.NaN;
|
|
108
119
|
qualifiedVersion = Number.NaN;
|
|
109
120
|
constructor(host) {
|
|
@@ -132,7 +143,7 @@ export class Lanes {
|
|
|
132
143
|
const slot = this.numbers.take(subject);
|
|
133
144
|
this.live++;
|
|
134
145
|
this.grow(slot + 1);
|
|
135
|
-
this.per[slot * 6 /* Per.SLOT */ + 0 /* Per.FILLED */] =
|
|
146
|
+
this.per[slot * 6 /* Per.SLOT */ + 0 /* Per.FILLED */] = this.fills;
|
|
136
147
|
this.per[slot * 6 /* Per.SLOT */ + 1 /* Per.SEEN */] = -1;
|
|
137
148
|
this.per[slot * 6 /* Per.SLOT */ + 2 /* Per.IDLE */] = 0;
|
|
138
149
|
this.per[slot * 6 /* Per.SLOT */ + 3 /* Per.LANE_PROBE */] = 0;
|
|
@@ -195,9 +206,10 @@ export class Lanes {
|
|
|
195
206
|
* them. One that a lane has not met yet, newly numbered or newly reached, takes the general path
|
|
196
207
|
* this frame, which is where it is first seen; so does one probed from inside a fill.
|
|
197
208
|
*/
|
|
198
|
-
prepare(slot, subject,
|
|
199
|
-
|
|
200
|
-
|
|
209
|
+
prepare(slot, subject, version, head) {
|
|
210
|
+
// Read, not passed: a double passed to a call V8 does not inline is boxed, once a probe.
|
|
211
|
+
const now = this.host.clock.now;
|
|
212
|
+
if (!this.filled(now, version) && this.begin(now, version) === 0 /* Begin.GENERAL */)
|
|
201
213
|
return this.general(slot);
|
|
202
214
|
if (slot < 0)
|
|
203
215
|
return false;
|
|
@@ -206,18 +218,9 @@ export class Lanes {
|
|
|
206
218
|
const probe = ++this.probes;
|
|
207
219
|
const per = this.per;
|
|
208
220
|
const o = slot * 6 /* Per.SLOT */;
|
|
209
|
-
let lane = per[o + 0 /* Per.FILLED */]
|
|
210
|
-
if (per[o + 1 /* Per.SEEN */] < this.wide
|
|
211
|
-
|
|
212
|
-
// after every other laned voice, the general path folds just those onto the lanes' values;
|
|
213
|
-
// otherwise it reads the general path all frame.
|
|
214
|
-
if (lane && per[o + 2 /* Per.IDLE */] === 0 && owable(this, slot))
|
|
215
|
-
this.owed.owe(slot, this.met);
|
|
216
|
-
else {
|
|
217
|
-
per[o + 0 /* Per.FILLED */] = 0;
|
|
218
|
-
lane = false;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
+
let lane = per[o + 0 /* Per.FILLED */] < this.busyFill && per[o + 2 /* Per.IDLE */] === 0;
|
|
222
|
+
if (per[o + 1 /* Per.SEEN */] < this.wide)
|
|
223
|
+
lane = meet(this, slot, subject, head, lane);
|
|
221
224
|
if (lane) {
|
|
222
225
|
per[o + 3 /* Per.LANE_PROBE */] = probe;
|
|
223
226
|
per[o + 5 /* Per.LANE_FILL */] = this.fills;
|
|
@@ -283,6 +286,20 @@ export class Lanes {
|
|
|
283
286
|
this.per[slot * 6 /* Per.SLOT */ + 4 /* Per.GENERAL_PROBE */] = ++this.probes;
|
|
284
287
|
return false;
|
|
285
288
|
}
|
|
289
|
+
/**
|
|
290
|
+
* Whether this fill leaves the subject at `slot` to the general path, for not having been probed
|
|
291
|
+
* this frame or the last: a probe of it before the next fill then takes the general path.
|
|
292
|
+
*/
|
|
293
|
+
unread(slot) {
|
|
294
|
+
const per = this.per;
|
|
295
|
+
const o = slot * 6 /* Per.SLOT */;
|
|
296
|
+
const lately = this.lately;
|
|
297
|
+
if (per[o + 3 /* Per.LANE_PROBE */] > lately ||
|
|
298
|
+
per[o + 4 /* Per.GENERAL_PROBE */] > lately)
|
|
299
|
+
return false;
|
|
300
|
+
per[o + 0 /* Per.FILLED */] = this.fills;
|
|
301
|
+
return true;
|
|
302
|
+
}
|
|
286
303
|
/** Whether a probe has read the subject since the frame began, on either path. */
|
|
287
304
|
probedThisFrame(slot) {
|
|
288
305
|
const from = this.frameProbes;
|
|
@@ -312,6 +329,11 @@ export class Lanes {
|
|
|
312
329
|
rests(slot) {
|
|
313
330
|
for (const ch of this.laned) {
|
|
314
331
|
const values = ch.values;
|
|
332
|
+
if (ch.op === 'last') {
|
|
333
|
+
if (!Number.isNaN(values[slot * ch.axes]))
|
|
334
|
+
return false;
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
315
337
|
if (ch.scalar) {
|
|
316
338
|
if (!(Math.abs(values[slot] - ch.rest) < 1e-9))
|
|
317
339
|
return false;
|
|
@@ -333,6 +355,12 @@ export class Lanes {
|
|
|
333
355
|
for (let c = 0; c < laned.length; c++) {
|
|
334
356
|
const ch = laned[c];
|
|
335
357
|
const axes = ch.axes;
|
|
358
|
+
// Never `delete`: it drops a reused out object into dictionary mode for good.
|
|
359
|
+
if (ch.op === 'last' && Number.isNaN(ch.values[slot * axes])) {
|
|
360
|
+
if (pose[ch.name] !== undefined)
|
|
361
|
+
pose[ch.name] = undefined;
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
336
364
|
if (ch.scalar) {
|
|
337
365
|
pose[ch.name] = ch.values[slot];
|
|
338
366
|
continue;
|
|
@@ -355,7 +383,7 @@ export class Lanes {
|
|
|
355
383
|
if (c.list[p] === slot)
|
|
356
384
|
unplace(this, c, p);
|
|
357
385
|
if (slot < this.cap)
|
|
358
|
-
this.per[slot * 6 /* Per.SLOT */ + 0 /* Per.FILLED */] =
|
|
386
|
+
this.per[slot * 6 /* Per.SLOT */ + 0 /* Per.FILLED */] = this.fills;
|
|
359
387
|
this.subjects[slot] = undefined;
|
|
360
388
|
}
|
|
361
389
|
grow(size) {
|
|
@@ -417,6 +445,7 @@ const methods = {
|
|
|
417
445
|
foldDelta,
|
|
418
446
|
foldRun,
|
|
419
447
|
foldInto,
|
|
448
|
+
gate,
|
|
420
449
|
};
|
|
421
450
|
for (const [name, value] of Object.entries(methods))
|
|
422
451
|
Object.defineProperty(Lanes.prototype, name, { value, writable: true, configurable: true });
|
package/dist/locus.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Mixer } from './mixer.js';
|
|
2
2
|
import type { Subject, Voice } from './voice.js';
|
|
3
3
|
/**
|
|
4
|
-
* What a fold with a locus in play gathers, kept from one fold to the next: the
|
|
4
|
+
* What a fold with a locus in play gathers, kept from one fold to the next: the contributions in
|
|
5
5
|
* voice order, each a voice's own or a locus's first member; every locus member; and per channel
|
|
6
6
|
* slot, a locus's folding value, the weight taken into it and the array it owns.
|
|
7
7
|
*/
|
|
@@ -11,7 +11,7 @@ export interface LocusScratch<I, O> {
|
|
|
11
11
|
helds: (Subject<unknown> | null)[];
|
|
12
12
|
deltas: (Record<string, unknown> | null)[];
|
|
13
13
|
weights: number[];
|
|
14
|
-
/** Per
|
|
14
|
+
/** Per contribution, -1 for a voice's own, or which of `names` it is. */
|
|
15
15
|
groups: number[];
|
|
16
16
|
names: string[];
|
|
17
17
|
m: number;
|
|
@@ -32,7 +32,7 @@ export declare function locusScratch<I, O>(channels: number): LocusScratch<I, O>
|
|
|
32
32
|
*/
|
|
33
33
|
export declare function own<I, O>(k: LocusScratch<I, O>, slot: number, value: number[], rest: number[]): number[];
|
|
34
34
|
/**
|
|
35
|
-
* Folds one locus's members into one
|
|
35
|
+
* Folds one locus's members into one contribution through each channel's own `lerp`: its value per
|
|
36
36
|
* channel goes in `k.values`, the channels in `k.touched` in the order first met, and its weight
|
|
37
37
|
* is returned. A channel folding by scale takes its value in an array of `k`'s own, lerped in
|
|
38
38
|
* place, since the fold only reads it.
|
package/dist/locus.js
CHANGED
|
@@ -35,7 +35,7 @@ export function own(k, slot, value, rest) {
|
|
|
35
35
|
return out;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
|
-
* Folds one locus's members into one
|
|
38
|
+
* Folds one locus's members into one contribution through each channel's own `lerp`: its value per
|
|
39
39
|
* channel goes in `k.values`, the channels in `k.touched` in the order first met, and its weight
|
|
40
40
|
* is returned. A channel folding by scale takes its value in an array of `k`'s own, lerped in
|
|
41
41
|
* place, since the fold only reads it.
|
package/dist/marks.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Listed } from './book.js';
|
|
2
2
|
import type { Mixer } from './mixer.js';
|
|
3
|
+
import type { Transport } from './transport.js';
|
|
3
4
|
import type { Mark } from './types.js';
|
|
4
5
|
import { type Voice } from './voice.js';
|
|
5
6
|
/** The host timestamp the mix clock reads mix time `t` at; Infinity where it never will. */
|
|
@@ -8,5 +9,7 @@ export declare function hostOf<I, O>(mix: Mixer<I, O>, t: number): number;
|
|
|
8
9
|
export declare function readingAt<I, O>(mix: Mixer<I, O>, u: number): number;
|
|
9
10
|
/** Every mark between two host timestamps, earliest first, with the order that tells each apart. */
|
|
10
11
|
export declare function listed<I, O>(mix: Mixer<I, O>, from: number, to: number): Listed[];
|
|
12
|
+
/** Every mark of every mix on a transport and every one announced on it, earliest first. */
|
|
13
|
+
export declare function listedAll(transport: Transport, from: number, to: number): Listed[];
|
|
11
14
|
/** When a voice reaches a mark, mix time, or undefined while nothing has fixed it. */
|
|
12
15
|
export declare function markOf<I, O>(mix: Mixer<I, O>, voice: Voice<I, O>, mark: Mark): number | undefined;
|
package/dist/marks.js
CHANGED
|
@@ -10,22 +10,52 @@ export function readingAt(mix, u) {
|
|
|
10
10
|
}
|
|
11
11
|
/** Every mark between two host timestamps, earliest first, with the order that tells each apart. */
|
|
12
12
|
export function listed(mix, from, to) {
|
|
13
|
-
const
|
|
14
|
-
const
|
|
13
|
+
const out = voiceMarks(mix, from, to);
|
|
14
|
+
for (const a of announcedMarks(mix.transport, from, to))
|
|
15
|
+
if (a.score !== undefined || a.slot === mix.slot)
|
|
16
|
+
out.push(a.listed);
|
|
17
|
+
return sorted(out);
|
|
18
|
+
}
|
|
19
|
+
/** Every mark of every mix on a transport and every one announced on it, earliest first. */
|
|
20
|
+
export function listedAll(transport, from, to) {
|
|
21
|
+
const out = [];
|
|
22
|
+
for (const m of transport.members)
|
|
23
|
+
out.push(...voiceMarks(m, from, to));
|
|
24
|
+
for (const a of announcedMarks(transport, from, to))
|
|
25
|
+
out.push(a.listed);
|
|
26
|
+
return sorted(out);
|
|
27
|
+
}
|
|
28
|
+
function sorted(out) {
|
|
29
|
+
return out.sort((a, b) => a.timestamp - b.timestamp || a.order - b.order);
|
|
30
|
+
}
|
|
31
|
+
function announcedMarks(transport, from, to) {
|
|
32
|
+
const lo = from - transport.offset;
|
|
33
|
+
const hi = to - transport.offset;
|
|
15
34
|
const out = [];
|
|
16
|
-
for (const a of
|
|
35
|
+
for (const a of transport.announced)
|
|
17
36
|
if (a.at >= lo && a.at <= hi)
|
|
18
37
|
out.push({
|
|
19
|
-
timestamp: a.at + mix.offset,
|
|
20
|
-
mark: undefined,
|
|
21
|
-
voice: undefined,
|
|
22
38
|
score: a.score,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
39
|
+
slot: a.slot,
|
|
40
|
+
listed: {
|
|
41
|
+
timestamp: a.at + transport.offset,
|
|
42
|
+
mark: undefined,
|
|
43
|
+
voice: undefined,
|
|
44
|
+
score: a.score,
|
|
45
|
+
name: a.name,
|
|
46
|
+
tags: a.tags,
|
|
47
|
+
mix: a.mix,
|
|
48
|
+
order: a.order,
|
|
49
|
+
},
|
|
26
50
|
});
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
function voiceMarks(mix, from, to) {
|
|
54
|
+
const lo = from - mix.offset;
|
|
55
|
+
const hi = to - mix.offset;
|
|
56
|
+
const out = [];
|
|
27
57
|
for (const voice of [...mix.cued, ...mix.gone]) {
|
|
28
|
-
for (const mark of ['start', 'in', 'out', 'end']) {
|
|
58
|
+
for (const mark of ['start', 'in', 'coast', 'out', 'end']) {
|
|
29
59
|
const m = markOf(mix, voice, mark);
|
|
30
60
|
const t = m === undefined ? m : hostOf(mix, m) - mix.offset;
|
|
31
61
|
if (t === undefined || t < lo || t > hi)
|
|
@@ -37,11 +67,11 @@ export function listed(mix, from, to) {
|
|
|
37
67
|
score: voice.spec.score,
|
|
38
68
|
name: voice.spec.name,
|
|
39
69
|
tags: voice.spec.tags ?? none,
|
|
70
|
+
mix: mix.name,
|
|
40
71
|
order: voice.id,
|
|
41
72
|
});
|
|
42
73
|
}
|
|
43
74
|
}
|
|
44
|
-
out.sort((a, b) => a.timestamp - b.timestamp || a.order - b.order);
|
|
45
75
|
return out;
|
|
46
76
|
}
|
|
47
77
|
/** When a voice reaches a mark, mix time, or undefined while nothing has fixed it. */
|
|
@@ -56,12 +86,19 @@ export function markOf(mix, voice, mark) {
|
|
|
56
86
|
return start;
|
|
57
87
|
if (mark === 'in')
|
|
58
88
|
return start + (voice.fade.in ?? 0);
|
|
89
|
+
if (mark === 'coast')
|
|
90
|
+
return coastOf(mix, voice, start);
|
|
59
91
|
const out = voice.out;
|
|
60
92
|
let outAt;
|
|
61
93
|
if (out !== null)
|
|
62
94
|
outAt = out.at;
|
|
63
95
|
else if (Number.isFinite(voice.outAt))
|
|
64
96
|
outAt = voice.outAt;
|
|
97
|
+
else if (voice.fitting !== null) {
|
|
98
|
+
const t = voice.timeAt(voice.fitting.end);
|
|
99
|
+
if (Number.isFinite(t))
|
|
100
|
+
outAt = Math.max(start, t);
|
|
101
|
+
}
|
|
65
102
|
else if (!voice.freezesAfter && Number.isFinite(voice.span)) {
|
|
66
103
|
const t = voice.timeAt(voice.span + voice.latest);
|
|
67
104
|
if (Number.isFinite(t))
|
|
@@ -76,5 +113,36 @@ export function markOf(mix, voice, mark) {
|
|
|
76
113
|
return out.deadline === undefined ? undefined : out.at + out.deadline;
|
|
77
114
|
return out.at + out.over;
|
|
78
115
|
}
|
|
79
|
-
|
|
116
|
+
const over = Number.isNaN(voice.outOver) ? (voice.fade.out ?? 0) : voice.outOver;
|
|
117
|
+
return outAt === undefined ? undefined : outAt + (mix.reduced ? 0 : over);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* When a voice's last pass ends, mix time: an owner's when its fit ends, or its last child's. None
|
|
121
|
+
* for a voice that never ends its passes, or that leaves or begins to fade before they end.
|
|
122
|
+
*/
|
|
123
|
+
function coastOf(mix, voice, start) {
|
|
124
|
+
if (voice.unplayed)
|
|
125
|
+
return undefined;
|
|
126
|
+
let t;
|
|
127
|
+
if (voice.fitting !== null)
|
|
128
|
+
t = voice.timeAt(voice.fitting.end);
|
|
129
|
+
else if (voice.holding !== null) {
|
|
130
|
+
const children = voice.holding.children;
|
|
131
|
+
if (children.length === 0)
|
|
132
|
+
return undefined;
|
|
133
|
+
t = Number.NEGATIVE_INFINITY;
|
|
134
|
+
for (const child of children) {
|
|
135
|
+
const c = markOf(mix, child, 'coast');
|
|
136
|
+
if (c === undefined)
|
|
137
|
+
return undefined;
|
|
138
|
+
t = Math.max(t, c);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
else if (Number.isFinite(voice.span))
|
|
142
|
+
t = voice.timeAt(voice.span + voice.latest);
|
|
143
|
+
if (t === undefined || !Number.isFinite(t))
|
|
144
|
+
return undefined;
|
|
145
|
+
t = Math.max(start, t);
|
|
146
|
+
const cut = voice.out !== null ? voice.out.at : voice.state === 'done' ? voice.doneAt : voice.outAt;
|
|
147
|
+
return cut < t ? undefined : t;
|
|
80
148
|
}
|
package/dist/meet.d.ts
CHANGED
|
@@ -9,8 +9,9 @@ import type { Subject } from './voice.js';
|
|
|
9
9
|
export declare function owable<I, O>(lanes: Lanes<I, O>, slot: number): boolean;
|
|
10
10
|
/**
|
|
11
11
|
* Gives a probed subject a position on every lane that started playing since the subject was last
|
|
12
|
-
* checked and that reaches it
|
|
12
|
+
* checked and that reaches it, and says whether the probe still reads the lanes, given `lane`,
|
|
13
|
+
* whether it would have. Kept out of `prepare`, which V8 then inlines into its callers.
|
|
13
14
|
*/
|
|
14
|
-
export declare function meet<I, O>(lanes: Lanes<I, O>, slot: number, subject: I, head: Subject<unknown> | null): boolean;
|
|
15
|
+
export declare function meet<I, O>(lanes: Lanes<I, O>, slot: number, subject: I, head: Subject<unknown> | null, lane: boolean): boolean;
|
|
15
16
|
/** Counts an idle lane more or fewer reaching a subject. */
|
|
16
17
|
export declare function reach<I, O>(lanes: Lanes<I, O>, slot: number, by: number): void;
|
package/dist/meet.js
CHANGED
|
@@ -27,9 +27,10 @@ export function owable(lanes, slot) {
|
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Gives a probed subject a position on every lane that started playing since the subject was last
|
|
30
|
-
* checked and that reaches it
|
|
30
|
+
* checked and that reaches it, and says whether the probe still reads the lanes, given `lane`,
|
|
31
|
+
* whether it would have. Kept out of `prepare`, which V8 then inlines into its callers.
|
|
31
32
|
*/
|
|
32
|
-
export function meet(lanes, slot, subject, head) {
|
|
33
|
+
export function meet(lanes, slot, subject, head, lane) {
|
|
33
34
|
const seen = lanes.per[slot * 6 /* Per.SLOT */ + 1 /* Per.SEEN */];
|
|
34
35
|
const from = seen < 0 ? -1 - seen : seen;
|
|
35
36
|
lanes.per[slot * 6 /* Per.SLOT */ + 1 /* Per.SEEN */] = lanes.epochs;
|
|
@@ -75,7 +76,18 @@ export function meet(lanes, slot, subject, head) {
|
|
|
75
76
|
lanes.met.push(voice.id);
|
|
76
77
|
met = true;
|
|
77
78
|
}
|
|
78
|
-
|
|
79
|
+
if (!met)
|
|
80
|
+
return lane;
|
|
81
|
+
// The fill ran before the subject had these positions. Where every voice it just met folds
|
|
82
|
+
// after every other laned voice, the general path folds just those onto the lanes' values;
|
|
83
|
+
// otherwise it reads the general path all frame.
|
|
84
|
+
const o = slot * 6 /* Per.SLOT */;
|
|
85
|
+
if (lane && lanes.per[o + 2 /* Per.IDLE */] === 0 && owable(lanes, slot)) {
|
|
86
|
+
lanes.owed.owe(slot, lanes.met);
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
lanes.per[o + 0 /* Per.FILLED */] = lanes.fills;
|
|
90
|
+
return false;
|
|
79
91
|
}
|
|
80
92
|
/** Places a crowd voice's row on the subject a probe met, as `Lane.add` adds a position. */
|
|
81
93
|
function place(lanes, voice, slot, subject, from, head) {
|