@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
package/dist/fill.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import { runBounded } from './bound.js';
|
|
1
2
|
import { foldNumber, lerpNumber } from './channels.js';
|
|
2
3
|
import { passAt, phaseAt, same, silent, weighed } from './clock.js';
|
|
3
4
|
import { flush } from './columns.js';
|
|
4
5
|
import { crowdsUpTo, freshen } from './crowd.js';
|
|
5
6
|
import { open as openRecord, shut as shutRecord } from './everyone.js';
|
|
6
7
|
import { unband } from './fold.js';
|
|
7
|
-
import {
|
|
8
|
+
import { foldRole, gatherRole, runRole } from './gather.js';
|
|
8
9
|
import { runKeys } from './keyfill.js';
|
|
10
|
+
import { keepProbed } from './lane.js';
|
|
9
11
|
import { reach } from './meet.js';
|
|
10
12
|
import { absent } from './numbers.js';
|
|
11
13
|
import { AT, NOTHING, readKeys, seg, segment, shifted } from './patch.js';
|
|
@@ -15,6 +17,8 @@ import { rested } from './turns.js';
|
|
|
15
17
|
// V8 reads a local const as a constant, where it reads an import from its module on every call.
|
|
16
18
|
const open = openRecord;
|
|
17
19
|
const shut = shutRecord;
|
|
20
|
+
/** The last `Arg.MARK` handed out, by every mix's lanes, so no two placings share one. */
|
|
21
|
+
let marks = 0;
|
|
18
22
|
/** The least prime at least `n`, and 1 below 2. */
|
|
19
23
|
function primeFrom(n) {
|
|
20
24
|
if (n < 2)
|
|
@@ -34,6 +38,7 @@ export function fillAll(lanes, now, version) {
|
|
|
34
38
|
flush(lanes);
|
|
35
39
|
const host = lanes.host;
|
|
36
40
|
lanes.filling = true;
|
|
41
|
+
const lookups = lanes.lookups;
|
|
37
42
|
try {
|
|
38
43
|
lanes.fills++;
|
|
39
44
|
lanes.owed.begin(lanes.fills);
|
|
@@ -84,17 +89,21 @@ export function fillAll(lanes, now, version) {
|
|
|
84
89
|
if (busy) {
|
|
85
90
|
for (const ch of lanes.laned)
|
|
86
91
|
rested(ch, size);
|
|
87
|
-
for (const g of lanes.
|
|
88
|
-
|
|
92
|
+
for (const g of lanes.roles)
|
|
93
|
+
gatherRole(lanes, g);
|
|
89
94
|
for (const lane of lanes.lanes) {
|
|
90
95
|
if (lane.idle)
|
|
91
96
|
continue;
|
|
92
|
-
if (lanes.crowds.length > 0)
|
|
97
|
+
if (lanes.crowds.length > 0) {
|
|
98
|
+
lanes.arg[6 /* Arg.MARK */] = Number.NaN;
|
|
93
99
|
crowdsUpTo(lanes, lane.voice.id);
|
|
100
|
+
}
|
|
94
101
|
lanes.run(lane);
|
|
95
102
|
}
|
|
96
|
-
if (lanes.crowds.length > 0)
|
|
103
|
+
if (lanes.crowds.length > 0) {
|
|
104
|
+
lanes.arg[6 /* Arg.MARK */] = Number.NaN;
|
|
97
105
|
crowdsUpTo(lanes, Number.POSITIVE_INFINITY);
|
|
106
|
+
}
|
|
98
107
|
for (const c of lanes.crowds)
|
|
99
108
|
if (!c.idle) {
|
|
100
109
|
c.bareFill = lanes.fills;
|
|
@@ -111,6 +120,7 @@ export function fillAll(lanes, now, version) {
|
|
|
111
120
|
}
|
|
112
121
|
lanes.moved = reading.moved;
|
|
113
122
|
lanes.inputs = reading.inputs;
|
|
123
|
+
lanes.holds = lanes.lookups !== lookups;
|
|
114
124
|
}
|
|
115
125
|
finally {
|
|
116
126
|
lanes.filling = false;
|
|
@@ -162,10 +172,7 @@ export function rest(lanes, lane) {
|
|
|
162
172
|
continue;
|
|
163
173
|
reach(lanes, slot, 1);
|
|
164
174
|
// A probe read this subject from the last fill, which this lane's weight stays from.
|
|
165
|
-
|
|
166
|
-
const o = p * 8 /* Row.STRIDE */;
|
|
167
|
-
data[o + 3 /* Row.PROBED */] = data[o + 2 /* Row.WEIGHT */];
|
|
168
|
-
}
|
|
175
|
+
keepProbed(data, p * 8 /* Row.STRIDE */, lanes.per, slot * 6 /* Per.SLOT */, lanes.fills);
|
|
169
176
|
}
|
|
170
177
|
}
|
|
171
178
|
export function wake(lanes, lane) {
|
|
@@ -205,6 +212,7 @@ export function parting(voice, slot) {
|
|
|
205
212
|
return subject === absent ? 1 : this.host.parting(voice, subject);
|
|
206
213
|
}
|
|
207
214
|
export function subjectAt(slot) {
|
|
215
|
+
this.lookups++;
|
|
208
216
|
let subject = this.subjects[slot];
|
|
209
217
|
if (subject === undefined) {
|
|
210
218
|
subject = this.numbers.subject(slot);
|
|
@@ -217,6 +225,7 @@ export function subjectAt(slot) {
|
|
|
217
225
|
export function reset(lane) {
|
|
218
226
|
const voice = lane.voice;
|
|
219
227
|
lane.placed = false;
|
|
228
|
+
this.arg[6 /* Arg.MARK */] = Number.NaN;
|
|
220
229
|
lane.read = false;
|
|
221
230
|
lane.weighed = false;
|
|
222
231
|
// With no fade in or out the envelope is 1 for every subject, which is what it would return.
|
|
@@ -232,11 +241,16 @@ export function run(lane) {
|
|
|
232
241
|
const voice = lane.voice;
|
|
233
242
|
if (voice.state === 'pending' || voice.state === 'done')
|
|
234
243
|
return;
|
|
235
|
-
|
|
236
|
-
|
|
244
|
+
const g = lane.group;
|
|
245
|
+
if (g !== null) {
|
|
246
|
+
if (!g.inline)
|
|
247
|
+
foldRole(this, lane, g);
|
|
248
|
+
else if (lane === g.members[0])
|
|
249
|
+
runRole(this, g);
|
|
237
250
|
return;
|
|
238
251
|
}
|
|
239
252
|
this.reset(lane);
|
|
253
|
+
lane.ran = this.fills;
|
|
240
254
|
if (lane.motion !== undefined && !voice.keeping) {
|
|
241
255
|
runMotion(this, lane, lane.motion);
|
|
242
256
|
return;
|
|
@@ -251,6 +265,10 @@ export function run(lane) {
|
|
|
251
265
|
this.runEveryone(lane);
|
|
252
266
|
return;
|
|
253
267
|
}
|
|
268
|
+
if (voice.bound !== null) {
|
|
269
|
+
runBounded(this, lane, voice.bound);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
254
272
|
for (let p = 0; p < list.length; p++) {
|
|
255
273
|
this.one(lane, p, list[p]);
|
|
256
274
|
// Its patch just made kept state: no further call this fill, the general path makes them.
|
|
@@ -281,7 +299,7 @@ export function runEveryone(lane) {
|
|
|
281
299
|
/**
|
|
282
300
|
* One subject's contribution from a lane's voice. True where the voice gave the subject a delta,
|
|
283
301
|
* as the general path's `contribution` does where it returns one, which is what makes a voice in a
|
|
284
|
-
*
|
|
302
|
+
* role one of its members for the subject.
|
|
285
303
|
*/
|
|
286
304
|
export function one(lane, p, slot) {
|
|
287
305
|
const host = this.host;
|
|
@@ -290,14 +308,12 @@ export function one(lane, p, slot) {
|
|
|
290
308
|
const arg = this.arg;
|
|
291
309
|
const data = lane.data;
|
|
292
310
|
const o = p * 8 /* Row.STRIDE */;
|
|
293
|
-
|
|
294
|
-
if (this.per[slot * 6 /* Per.SLOT */ + 5 /* Per.LANE_FILL */] === this.fills - 1)
|
|
295
|
-
data[o + 3 /* Row.PROBED */] = data[o + 2 /* Row.WEIGHT */];
|
|
311
|
+
keepProbed(data, o, this.per, slot * 6 /* Per.SLOT */, this.fills);
|
|
296
312
|
if (this.lately >= 0 && this.unread(slot))
|
|
297
313
|
return false;
|
|
298
314
|
const delay = data[o + 0 /* Row.DELAY */];
|
|
299
315
|
const raw = elapsedNow - delay;
|
|
300
|
-
//
|
|
316
|
+
// Its freezes applied, written out: V8 left a function for it out of line here, a call a subject.
|
|
301
317
|
const elapsed = !(raw >= 0)
|
|
302
318
|
? voice.freezesBefore
|
|
303
319
|
? 0
|
|
@@ -319,6 +335,8 @@ export function one(lane, p, slot) {
|
|
|
319
335
|
lane.placedAt = elapsed;
|
|
320
336
|
lane.phase = phaseAt(elapsed, voice.duration, voice.passes);
|
|
321
337
|
lane.pass = passAt(elapsed, voice.duration, voice.passes);
|
|
338
|
+
arg[6 /* Arg.MARK */] = ++marks;
|
|
339
|
+
lane.mark = arg[6 /* Arg.MARK */];
|
|
322
340
|
}
|
|
323
341
|
const since = data[o + 1 /* Row.SINCE */];
|
|
324
342
|
if (!lane.flat && (!lane.weighed || !same(since, lane.weighedSince))) {
|
|
@@ -352,6 +370,14 @@ export function one(lane, p, slot) {
|
|
|
352
370
|
lane.readAt = elapsed;
|
|
353
371
|
this.gather(lane, lane.delta);
|
|
354
372
|
}
|
|
373
|
+
// A signal is handed the gap since the subject's last read, which this read is, as it is on
|
|
374
|
+
// the general path; the record's delta is not this read's, so a probe reads it again.
|
|
375
|
+
if (typeof voice.spec.weight === 'function') {
|
|
376
|
+
const rec = lane.records[p];
|
|
377
|
+
rec.probed = this.now;
|
|
378
|
+
rec.seeks = voice.seeks;
|
|
379
|
+
rec.delta = null;
|
|
380
|
+
}
|
|
355
381
|
if (w > 0) {
|
|
356
382
|
arg[0 /* Arg.WEIGHT */] = w;
|
|
357
383
|
this.fold(lane, slot);
|
|
@@ -359,8 +385,9 @@ export function one(lane, p, slot) {
|
|
|
359
385
|
return true;
|
|
360
386
|
}
|
|
361
387
|
const rec = lane.records[p];
|
|
362
|
-
// The general path makes a voice's first call for a subject, where it first sees it play
|
|
363
|
-
|
|
388
|
+
// The general path makes a voice's first call for a subject, where it first sees it play, or a
|
|
389
|
+
// probe meeting the voice makes it here, or the fill of a lane that took every subject.
|
|
390
|
+
if (Number.isNaN(rec.probed) && !this.meeting && !lane.every) {
|
|
364
391
|
this.late.push(slot);
|
|
365
392
|
return false;
|
|
366
393
|
}
|
|
@@ -399,7 +426,7 @@ export function foldKeys(voice, chans, slot) {
|
|
|
399
426
|
const a = seg.a;
|
|
400
427
|
const b = seg.b;
|
|
401
428
|
const u = seg.eased;
|
|
402
|
-
if (ch.scalar || !ch.plain) {
|
|
429
|
+
if (ch.scalar || !ch.plain || !ch.straight) {
|
|
403
430
|
this.foldInto(ch, slot, voice.lerps[i](a, b, u));
|
|
404
431
|
continue;
|
|
405
432
|
}
|
|
@@ -440,8 +467,13 @@ export function call(voice, chans, rec, slot) {
|
|
|
440
467
|
this.foldDelta(chans, slot, rec.delta);
|
|
441
468
|
return true;
|
|
442
469
|
}
|
|
443
|
-
if (silent(voice, w))
|
|
470
|
+
if (silent(voice, w)) {
|
|
471
|
+
// As `contribution` leaves a silent read, so the next one is handed the same `dt`.
|
|
472
|
+
rec.delta = null;
|
|
473
|
+
rec.probed = this.now;
|
|
474
|
+
rec.seeks = voice.seeks;
|
|
444
475
|
return false;
|
|
476
|
+
}
|
|
445
477
|
const kept = reading.kept;
|
|
446
478
|
host.ready(voice, subject, rec);
|
|
447
479
|
if (this.keeps)
|
package/dist/fit.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* How hard a claim on time holds when it meets another
|
|
2
|
+
* How hard a claim on time holds when it meets another. The weaker gives way.
|
|
3
3
|
*
|
|
4
4
|
* @category score
|
|
5
5
|
*/
|
|
6
6
|
export type Strength = 'weak' | 'strong' | 'required';
|
|
7
7
|
/**
|
|
8
|
-
* How a span lays its children out
|
|
9
|
-
*
|
|
8
|
+
* How a span lays its children out. Each after the one before has ended, partway through it, or all
|
|
9
|
+
* at once.
|
|
10
10
|
*
|
|
11
11
|
* @category score
|
|
12
12
|
*/
|
|
13
13
|
export type Order = 'queue' | 'stagger' | 'together';
|
|
14
14
|
/**
|
|
15
|
-
* One child of a span as a fit sees it
|
|
15
|
+
* One child of a span as a fit sees it. What is left of it, and the ways it may give way.
|
|
16
16
|
*
|
|
17
17
|
* @category score
|
|
18
18
|
*/
|
|
@@ -25,13 +25,16 @@ export interface Claim {
|
|
|
25
25
|
faster: number;
|
|
26
26
|
/** How many times slower it may play; 1 for no slower. */
|
|
27
27
|
slower: number;
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Whether it may run alongside the one before it. It may where the span's order would not have
|
|
30
|
+
* it.
|
|
31
|
+
*/
|
|
29
32
|
overlap: boolean;
|
|
30
33
|
/** Whether it may jump to its end instead of playing. */
|
|
31
34
|
ballast: boolean;
|
|
32
35
|
priority: Strength;
|
|
33
36
|
/**
|
|
34
|
-
* Span ms from now before which it may not start
|
|
37
|
+
* Span ms from now before which it may not start. From its `earliest`; absent for none. Below 0
|
|
35
38
|
* where it has passed, which places the child there.
|
|
36
39
|
*/
|
|
37
40
|
floor?: number;
|
|
@@ -52,9 +55,9 @@ export interface SpanClaim {
|
|
|
52
55
|
share: number;
|
|
53
56
|
}
|
|
54
57
|
/**
|
|
55
|
-
* What a fit decides
|
|
56
|
-
*
|
|
57
|
-
* the span ms the span may run past its budget.
|
|
58
|
+
* What a fit decides for each child. A rate over its own, and whether it is skipped, per child in
|
|
59
|
+
* the order given. `share` is how far through the one before a child that may overlap starts, and
|
|
60
|
+
* `allow` the span ms the span may run past its budget.
|
|
58
61
|
*
|
|
59
62
|
* @category score
|
|
60
63
|
*/
|
|
@@ -65,7 +68,8 @@ export interface FitPlan {
|
|
|
65
68
|
allow: number;
|
|
66
69
|
}
|
|
67
70
|
/**
|
|
68
|
-
* A strategy for fitting a span's children into its budget
|
|
71
|
+
* A strategy for fitting a span's children into its budget. It goes from the plan so far to a new
|
|
72
|
+
* one.
|
|
69
73
|
*
|
|
70
74
|
* @category score
|
|
71
75
|
*/
|
|
@@ -73,23 +77,31 @@ export type Fit = (span: SpanClaim, kids: readonly Claim[], plan: FitPlan) => Fi
|
|
|
73
77
|
/** How far through the one before a child starts under each order, before any fit. */
|
|
74
78
|
export declare function shareOf(order: Order, stagger: number): number;
|
|
75
79
|
/**
|
|
76
|
-
* The plan before any fit
|
|
80
|
+
* The plan before any fit. Every child at its own rate, played, in the span's order.
|
|
77
81
|
*
|
|
78
82
|
* @category score
|
|
79
83
|
*/
|
|
80
84
|
export declare function plain(span: SpanClaim, kids: readonly Claim[]): FitPlan;
|
|
81
85
|
/**
|
|
82
|
-
* Where
|
|
83
|
-
* is where it is, at 0; each pending one starts its share through the one before it, or at its
|
|
84
|
-
* floor where that is later. A floor already past places a child before now, so it starts partway
|
|
85
|
-
* through; one without a floor starts no sooner than now.
|
|
86
|
+
* Where `layout` puts a span's children.
|
|
86
87
|
*
|
|
87
88
|
* @category score
|
|
88
89
|
*/
|
|
89
|
-
export
|
|
90
|
+
export interface Layout {
|
|
91
|
+
/** Where each child starts, span ms from now, in the order given. */
|
|
90
92
|
at: number[];
|
|
93
|
+
/** How long they take together, span ms from now. */
|
|
91
94
|
length: number;
|
|
92
|
-
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Where a plan puts each child, and how long they take together. Times are span ms from now. A
|
|
98
|
+
* playing child is where it is, at 0; each pending one starts its share through the one before it,
|
|
99
|
+
* or at its floor where that is later. A floor already past places a child before now, so it starts
|
|
100
|
+
* partway through; one without a floor starts no sooner than now.
|
|
101
|
+
*
|
|
102
|
+
* @category score
|
|
103
|
+
*/
|
|
104
|
+
export declare function layout(span: SpanClaim, kids: readonly Claim[], plan: FitPlan): Layout;
|
|
93
105
|
/**
|
|
94
106
|
* Moves every child's rate by one factor toward the budget, before the span's fit: faster where
|
|
95
107
|
* they run past it, each no faster than its `faster` allows, and slower where they leave room in
|
|
@@ -97,8 +109,8 @@ export declare function layout(span: SpanClaim, kids: readonly Claim[], plan: Fi
|
|
|
97
109
|
*/
|
|
98
110
|
export declare function rescale(span: SpanClaim, kids: readonly Claim[], plan: FitPlan): FitPlan;
|
|
99
111
|
/**
|
|
100
|
-
* Starts children that may overlap sooner
|
|
101
|
-
*
|
|
112
|
+
* Starts children that may overlap sooner, until they fit. Each moves closer after the one before,
|
|
113
|
+
* toward all at once.
|
|
102
114
|
*
|
|
103
115
|
* @category score
|
|
104
116
|
*/
|
|
@@ -116,13 +128,20 @@ export declare function shed(): Fit;
|
|
|
116
128
|
*/
|
|
117
129
|
export declare function conclude(): Fit;
|
|
118
130
|
/**
|
|
119
|
-
*
|
|
131
|
+
* What `overrun` and `lax` take.
|
|
120
132
|
*
|
|
121
133
|
* @category score
|
|
122
134
|
*/
|
|
123
|
-
export
|
|
135
|
+
export interface OverrunOptions {
|
|
136
|
+
/** The most the span may run, as a multiple of its budget. Default: no limit. */
|
|
124
137
|
cap?: number;
|
|
125
|
-
}
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Lets the span run past its budget. Up to `cap` times it, or without limit.
|
|
141
|
+
*
|
|
142
|
+
* @category score
|
|
143
|
+
*/
|
|
144
|
+
export declare function overrun(opts?: OverrunOptions): Fit;
|
|
126
145
|
/**
|
|
127
146
|
* Tries each fit in turn, handing the plan on, and stops once the children fit.
|
|
128
147
|
*
|
|
@@ -130,13 +149,12 @@ export declare function overrun(opts?: {
|
|
|
130
149
|
*/
|
|
131
150
|
export declare function pipe(...fits_: readonly Fit[]): Fit;
|
|
132
151
|
/**
|
|
133
|
-
* Every way of giving way
|
|
152
|
+
* Every way of giving way, overrunning only once the rest are spent. It applies after the span's
|
|
153
|
+
* retiming.
|
|
134
154
|
*
|
|
135
155
|
* @category score
|
|
136
156
|
*/
|
|
137
|
-
export declare function lax(opts?:
|
|
138
|
-
cap?: number;
|
|
139
|
-
}): Fit;
|
|
157
|
+
export declare function lax(opts?: OverrunOptions): Fit;
|
|
140
158
|
/** The fit a span takes without one of its own. */
|
|
141
159
|
export declare const defaultFit: Fit;
|
|
142
160
|
/**
|
package/dist/fit.js
CHANGED
|
@@ -3,7 +3,7 @@ export function shareOf(order, stagger) {
|
|
|
3
3
|
return order === 'queue' ? 1 : order === 'together' ? 0 : stagger;
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
|
-
* The plan before any fit
|
|
6
|
+
* The plan before any fit. Every child at its own rate, played, in the span's order.
|
|
7
7
|
*
|
|
8
8
|
* @category score
|
|
9
9
|
*/
|
|
@@ -16,10 +16,10 @@ export function plain(span, kids) {
|
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
* Where a plan puts each child,
|
|
20
|
-
* is where it is, at 0; each pending one starts its share through the one before it,
|
|
21
|
-
* floor where that is later. A floor already past places a child before now, so it starts
|
|
22
|
-
* through; one without a floor starts no sooner than now.
|
|
19
|
+
* Where a plan puts each child, and how long they take together. Times are span ms from now. A
|
|
20
|
+
* playing child is where it is, at 0; each pending one starts its share through the one before it,
|
|
21
|
+
* or at its floor where that is later. A floor already past places a child before now, so it starts
|
|
22
|
+
* partway through; one without a floor starts no sooner than now.
|
|
23
23
|
*
|
|
24
24
|
* @category score
|
|
25
25
|
*/
|
|
@@ -87,8 +87,8 @@ export function rescale(span, kids, plan) {
|
|
|
87
87
|
return fits(span, kids, at(f)) ? at(f) : at(Math.max(1, f - 1e-9));
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
|
-
* Starts children that may overlap sooner
|
|
91
|
-
*
|
|
90
|
+
* Starts children that may overlap sooner, until they fit. Each moves closer after the one before,
|
|
91
|
+
* toward all at once.
|
|
92
92
|
*
|
|
93
93
|
* @category score
|
|
94
94
|
*/
|
|
@@ -130,7 +130,7 @@ export function conclude() {
|
|
|
130
130
|
return (_span, kids, plan) => ({ ...plan, skip: kids.map(() => true) });
|
|
131
131
|
}
|
|
132
132
|
/**
|
|
133
|
-
* Lets the span run past its budget
|
|
133
|
+
* Lets the span run past its budget. Up to `cap` times it, or without limit.
|
|
134
134
|
*
|
|
135
135
|
* @category score
|
|
136
136
|
*/
|
|
@@ -158,7 +158,8 @@ export function pipe(...fits_) {
|
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
161
|
-
* Every way of giving way
|
|
161
|
+
* Every way of giving way, overrunning only once the rest are spent. It applies after the span's
|
|
162
|
+
* retiming.
|
|
162
163
|
*
|
|
163
164
|
* @category score
|
|
164
165
|
*/
|
package/dist/fold.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Mixer } from './mixer.js';
|
|
2
|
+
import type { Subject } from './subject.js';
|
|
2
3
|
import type { Channel } from './types.js';
|
|
3
|
-
import
|
|
4
|
+
import type { Voice } from './voice.js';
|
|
4
5
|
export type Key<O> = keyof O & string;
|
|
5
6
|
export declare function near(a: unknown, b: unknown): boolean;
|
|
6
7
|
/**
|
|
@@ -10,31 +11,6 @@ export declare function near(a: unknown, b: unknown): boolean;
|
|
|
10
11
|
*/
|
|
11
12
|
export declare function merged(channel: Channel<unknown>, acc: unknown, b: unknown): unknown;
|
|
12
13
|
export type Values = Record<string, unknown>;
|
|
13
|
-
/**
|
|
14
|
-
* One live voice's delta for one subject this frame, through its record for the subject, or null
|
|
15
|
-
* when it does not reach. Its weight is left in `w`.
|
|
16
|
-
*/
|
|
17
|
-
export declare function contribution<I, O>(this: Mixer<I, O>, voice: Voice<I, O>, subject: I, now: number, held: Subject<unknown>): Record<string, unknown> | null;
|
|
18
|
-
/** Reads a keys voice's stops at `held.phase` into the subject's delta, through the voice's scratch. */
|
|
19
|
-
export declare function keyed<I, O>(this: Mixer<I, O>, voice: Voice<I, O>, subject: I, held: Subject<unknown>): Record<string, unknown>;
|
|
20
|
-
/**
|
|
21
|
-
* Runs `step` once per whole interval between where this subject last stopped and now, on a grid
|
|
22
|
-
* counted from when its delay ran out, and leaves the remainder for the next sample. Counting
|
|
23
|
-
* rather than adding keeps the grid where it is however many samples it is reached through.
|
|
24
|
-
*/
|
|
25
|
-
export declare function tick<I, O>(this: Mixer<I, O>, voice: Voice<I, O>, subject: I, held: Subject<unknown>, tick: number, to: number): void;
|
|
26
|
-
/**
|
|
27
|
-
* Stop 0 for a retargeting voice: the subject's pose in the frame before this voice contributes.
|
|
28
|
-
* With no such frame on record — a voice cued before the subject was ever probed, or a host that
|
|
29
|
-
* samples into its own object — it is this frame's pose with every other voice folded in.
|
|
30
|
-
*/
|
|
31
|
-
export declare function baseFor<I, O>(this: Mixer<I, O>, voice: Voice<I, O>, subject: I): Record<string, unknown>;
|
|
32
|
-
/**
|
|
33
|
-
* How fast each numeric channel this voice writes was moving, from the subject's last two probed
|
|
34
|
-
* poses, in units per ms. Undefined with fewer than two on record, which starts the voice at rest.
|
|
35
|
-
*/
|
|
36
|
-
export declare function slopeFor<I, O>(this: Mixer<I, O>, voice: Voice<I, O>, subject: I): Record<string, unknown> | undefined;
|
|
37
|
-
export declare function isRest<I, O>(this: Mixer<I, O>, delta: Record<string, unknown>): boolean;
|
|
38
14
|
/**
|
|
39
15
|
* A record's band state once its voice is skipped at weight 0: off, as `passes` would have said, so
|
|
40
16
|
* a weight that comes back inside the band does not find it still on.
|
|
@@ -48,11 +24,6 @@ export declare function apply<I, O>(this: Mixer<I, O>, pose: Record<string, unkn
|
|
|
48
24
|
export declare function clamp<I, O>(this: Mixer<I, O>, pose: Record<string, unknown>): Record<string, unknown>;
|
|
49
25
|
/** A folded value held to its channel's bounds: a number clamped, an array clamped in place. */
|
|
50
26
|
export declare function bound(channel: Channel<unknown>, v: unknown): unknown;
|
|
51
|
-
/**
|
|
52
|
-
* Whether a fold's next voice is its chain's next record, `held`, and not the next voice sharing
|
|
53
|
-
* one record, `sharers[q]`: the two lists are each in voice order, and a fold takes them as one.
|
|
54
|
-
*/
|
|
55
|
-
export declare function chainFirst<I, O>(held: Subject<unknown> | null, sharers: readonly Voice<I, O>[], q: number): boolean;
|
|
56
27
|
/**
|
|
57
28
|
* After a fold read a sharing voice for the subject numbered `slot`: keeps the weight it gave and
|
|
58
29
|
* what the read left on its record, and gives the fold's place in `sharers`, which moves back where
|
|
@@ -69,9 +40,9 @@ export declare function linked<I, O>(this: Mixer<I, O>, subject: I): Subject<unk
|
|
|
69
40
|
/** The fold after a subject's chain is linked and its lanes asked whether it reads from them. */
|
|
70
41
|
export declare function foldWith<I, O>(this: Mixer<I, O>, subject: I, out: O, head: Subject<unknown> | null, laned: boolean, dry: boolean, except?: number): O;
|
|
71
42
|
/**
|
|
72
|
-
* `foldWith`'s voices in a mix with a
|
|
43
|
+
* `foldWith`'s voices in a mix with a role or a voice sharing one record in it. The chain is taken
|
|
73
44
|
* again where a voice stopped sharing since it was linked, as a patch call in this probe's fill can
|
|
74
|
-
* make one do. With no
|
|
45
|
+
* make one do. With no role, the chain's records fold in voice order, and each voice sharing one
|
|
75
46
|
* record, which is in no chain, before the first chain record that comes after it.
|
|
76
47
|
*/
|
|
77
48
|
export declare function foldDetour<I, O>(this: Mixer<I, O>, subject: I, pose: Record<string, unknown>, linkedHead: Subject<unknown>, laned: boolean, dry: boolean, except: number | undefined, owed: number): O;
|
|
@@ -82,7 +53,3 @@ export declare function foldDetour<I, O>(this: Mixer<I, O>, subject: I, pose: Re
|
|
|
82
53
|
export declare function foldSharers<I, O>(this: Mixer<I, O>, pose: Record<string, unknown>, subject: I, head: Subject<unknown>, q: number, before: number, laned: boolean, dry: boolean, except: number | undefined, owed: number): number;
|
|
83
54
|
/** Whether the subject numbered `owed` reads laned `voice` from the general path this fill. */
|
|
84
55
|
export declare function owedBy<I, O>(this: Mixer<I, O>, owed: number, voice: Voice<I, O>): boolean;
|
|
85
|
-
/** `foldWith`'s voices with a locus in play: each locus folds at its first member's place. */
|
|
86
|
-
export declare function foldLoci<I, O>(this: Mixer<I, O>, subject: I, pose: Record<string, unknown>, head: Subject<unknown>, laned: boolean, dry: boolean, except: number | undefined, owed: number): O;
|
|
87
|
-
/** `contribution`, or for a dry fold a subject already probed this frame, without advancing it. */
|
|
88
|
-
export declare function read<I, O>(this: Mixer<I, O>, voice: Voice<I, O>, subject: I, now: number, dry: boolean, held: Subject<unknown>): Record<string, unknown> | null;
|