Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(audio): relabel a joined clip's takes without re-cutting them (#1011)
EtienneLescotcab5ad85776a
diff --git a/src/lib/ai-edition/document/insertion.test.ts b/src/lib/ai-edition/document/insertion.test.tsindex 8e87531a2..2581c7f0a 100644--- a/src/lib/ai-edition/document/insertion.test.ts+++ b/src/lib/ai-edition/document/insertion.test.ts@@ -226,6 +226,27 @@ describe("a music bed over the cut (#1011)", () => {]);expect(new Set(next.audioTracks.map((t) => t.trackId)).size).toBe(1);});++ it("stays on the recording when the word is deleted", () => {+ // The rejoined clip used to be re-cut against the clips as they were before the join,+ // which put the right half's id back, and the bed lost everything after the word. Each+ // piece keeps its place in the file: what played under the word stays played.+ const back = removeGeneratedClips(withInsertion(withBed()), ["synth_1"]);+ expect(spans(back)).toEqual([+ ["c1", 2000, 4000, 0],+ ["c1", 4000, 8000, 2150],+ ]);+ });++ it("stays on the recording when the word is dragged away", () => {+ // The same join, reached by a reorder. The word takes the bed it carried with it.+ const moved = moveClip(withInsertion(withBed()), "ext:synth_1", 2, "user", "");+ expect(spans(moved)).toEqual([+ ["c1", 2000, 4000, 0],+ ["c1", 4000, 8000, 2150],+ ["ext:synth_1", 10_000, 10_150, 2000],+ ]);+ });});describe("deleting the amber clip from the TIMELINE, not from the transcript", () => {diff --git a/src/lib/ai-edition/document/timeline.ts b/src/lib/ai-edition/document/timeline.tsindex 06e7964ed..0e3a6046a 100644--- a/src/lib/ai-edition/document/timeline.ts+++ b/src/lib/ai-edition/document/timeline.ts@@ -1275,15 +1275,20 @@ function joinable(left: AxcutClip, right: AxcutClip): boolean {* zoom, an annotation and an audio take all name a clip the same way, and an id that no* longer exists has to stop being named. */function reanchorRows(document: AxcutDocument, absorbed: Map<string, string>): AxcutDocument {- const moved = mapAllRegionCollections(document, (regions) =>+ const relabel = <T extends StoredRegion>(regions: T[]): T[] =>regions.map((region) =>hasCompleteClipAnchor(region) && absorbed.has(region.clipId)? { ...region, clipId: absorbed.get(region.clipId) as string }: region,- ),- );+ );+ const moved = mapAllRegionCollections(document, relabel);return {...moved,+ // Relabelled and nothing more. The walk above also re-cuts every take, but against the+ // clips as they were, which put the absorbed id straight back and the rederive that+ // follows dropped what the absorbed clip carried (#1011). That rederive re-cuts them+ // against the joined clips.+ audioTracks: relabel(document.audioTracks),timeline: {...moved.timeline,trimRanges: moved.timeline.trimRanges.map((trim) =>