Skip to content

The open-source CapCut alternative

Merge branch 'temp'

Maze Wintherfcc09e80e253
diff --cc apps/web/src/core/managers/timeline-manager.ts
index a6f2462a,d5da1003..3abde47b
--- a/apps/web/src/core/managers/timeline-manager.ts
+++ b/apps/web/src/core/managers/timeline-manager.ts
@@@ -16,9 -11,10 +16,10 @@@ import type
AnimationPath,
AnimationInterpolation,
AnimationValue,
+ ScalarCurveKeyframePatch,
} from "@/lib/animation/types";
-import { calculateTotalDuration } from "@/lib/timeline";
import { getLastFrameTime } from "opencut-wasm";
+import { BatchCommand } from "@/lib/commands";
import {
AddTrackCommand,
RemoveTrackCommand,
diff --cc apps/web/src/lib/timeline/audio-separation/__tests__/index.test.ts
index 1946f1e0,ca54f4cd..f2b17d1a
--- a/apps/web/src/lib/timeline/audio-separation/__tests__/index.test.ts
+++ b/apps/web/src/lib/timeline/audio-separation/__tests__/index.test.ts
@@@ -1,5 -1,7 +1,6 @@@
import { describe, expect, test } from "bun:test";
+ import { upsertElementKeyframe } from "@/lib/animation";
-import type { MediaAsset } from "@/lib/media/types";
-import type { AudioElement, VideoElement } from "@/lib/timeline";
+import type { UploadAudioElement, VideoElement } from "@/lib/timeline";
import {
buildSeparatedAudioElement,
doesElementHaveEnabledAudio,
@@@ -126,20 -124,22 +105,40 @@@ function buildVideoElement
};
}
+function buildAudioElement(
+ overrides: Partial<UploadAudioElement> = {},
+): UploadAudioElement {
+ return {
+ id: "audio-1",
+ type: "audio",
+ sourceType: "upload",
+ mediaId: "audio-media-1",
+ name: "Detached audio",
+ duration: 5,
+ startTime: 0,
+ trimStart: 0,
+ trimEnd: 0,
+ volume: 0,
+ ...overrides,
+ } satisfies UploadAudioElement;
+}
++
+ function buildAnimations() {
+ const withVolume = upsertElementKeyframe({
+ animations: undefined,
+ propertyPath: "volume",
+ time: 2,
+ value: -12,
+ interpolation: "linear",
+ keyframeId: "volume-keyframe",
+ });
+
+ return upsertElementKeyframe({
+ animations: withVolume,
+ propertyPath: "opacity",
+ time: 1,
+ value: 0.5,
+ interpolation: "linear",
+ keyframeId: "opacity-keyframe",
+ });
+ }