import type { Peaks } from "@/components/Waveform"; import { fileAt, fileSpans, peaksOnSource, sourceAt, type FileMap } from "@/lib/report/fileMedia.mjs"; // --------------------------------------------------------------------------- // WHAT A BENCH PLAYS, behind one shape (lane/reel-bench): the bench's own // work -- edges, gaps, cues, words, the mute mark -- is always in SOURCE // seconds; a media adapter says where those seconds are in the picture and // the sound. // // sourceWindow the clip's cached raw window (the clip bench): the decode // clock IS the source clock, the element is offset by the // window's start (`fetchStart`), and a clip's gaps are still // in the file -- playback skips them. // renderedFile a rendered file in the project (a take's master, the // reel's walk) with its map onto the clip's source // (lib/report/fileMedia.mjs): the decode clock and the // element are the FILE's clock, and the render's own gaps // are already out of it. // // The playback engine (useBenchPlayer.ts) schedules on the decode clock and // reports the playhead back in source seconds; the waveform's peaks come // back on the source clock either way. // --------------------------------------------------------------------------- export type Span = { from: number; to: number }; export type BenchMedia = { kind: "source" | "file"; /** What is playing, for the decode cache: a new key is new audio. Null: nothing to play. */ key: string | null; /** The