Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit f7d79f1d097c8313db734a284ff485023b810b65
parent 15b28673b49b6eb91e70888b38e1849a392c05bc
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Sun,  1 Nov 2026 16:03:54 -0500

umtool Play: the sound is asked for in the order it is due -- a clip behind whose sound still runs past the playhead (a crossfade's tail into this one) first, then the one playing, then those ahead, then the rest behind; a clip's pieces still to sound before those played

Per-piece decodes are more requests than one per clip, and the browser runs a few at once and queues the rest: asked in index order from the clip playing, og1's last piece (whose tail crossfades into nt1's start) was asked for last and the clock held on it ~16 s at the start of nt1 (the probe, 2026-11-01). Asked first, the clock starts in ~4 s.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mumtool/components/projects/review/playEngine/engine.ts | 24++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/umtool/components/projects/review/playEngine/engine.ts b/umtool/components/projects/review/playEngine/engine.ts @@ -380,20 +380,36 @@ export class PlayEngine { return { media: e.media, need: d.need, ask: d.ask }; } - /** Decode the clips around the playhead -- the one playing first, then those ahead, then behind; the bank lets the far ones go. */ + /** + * Decode the clips around the playhead, in the order they are due: a clip + * behind whose sound still runs past the playhead (the tail of a crossfade + * into this one) first, then the one playing, then those ahead, then the + * rest behind -- the browser runs a few requests at once and queues the + * rest. The bank lets the far ones go. + */ private prefetch() { const keys: string[] = []; const last = this.plan.items.length - 1; - const order: number[] = []; + const t = this.now(); + const sounding = (i: number) => { + const id = this.plan.items[i]?.id; + return this.spans.some((s) => s.id === id && s.to > t); + }; + const behind: number[] = []; + for (let i = this.cur - 1; i >= Math.max(0, this.cur - DECODE_BEHIND); i -= 1) behind.push(i); + const order: number[] = behind.filter(sounding); for (let i = this.cur; i <= Math.min(last, this.cur + DECODE_AHEAD); i += 1) order.push(i); - for (let i = this.cur - 1; i >= Math.max(0, this.cur - DECODE_BEHIND); i -= 1) order.push(i); + order.push(...behind.filter((i) => !sounding(i))); for (const i of order) { const it = this.plan.items[i]; if (!it?.clip) continue; const ds = this.decodes.get(it.id); const media = this.entries.get(it.id)?.media; if (!ds || !media) continue; - for (const d of ds) { + // Its pieces still to sound first (a seek into a gapped clip: the piece playing before the ones behind it). + const mine = this.spans.filter((x) => x.id === it.id); + const pieces = ds.map((d, k) => ({ d, done: (mine[k]?.to ?? Infinity) <= t })); + for (const { d } of [...pieces.filter((x) => !x.done), ...pieces.filter((x) => x.done)]) { const got = this.bank.resolve(it.id, media, d.need, d.ask); keys.push(got.key); void got.p.then((sound) => {