summaryrefslogtreecommitdiff
path: root/apps/web/src/lib/timeline/audio-separation/index.ts
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2026-04-06 01:23:47 +0200
committerMaze Winther <mazewinther@gmail.com>2026-04-06 01:23:47 +0200
commitfcc09e80e253831a163e2e4941542e0b34f80740 (patch)
tree4cc7aafd0756bb3fa23dfd41080237e462b5ecf2 /apps/web/src/lib/timeline/audio-separation/index.ts
parentc56d6f8188cc1c0e72d75611269a8bda7b79e727 (diff)
parentdedb13546a16235e7d6649961d0c9b235f62aa34 (diff)
downloadopencut-fcc09e80e253831a163e2e4941542e0b34f80740.tar.gz
Merge branch 'temp'
Diffstat (limited to 'apps/web/src/lib/timeline/audio-separation/index.ts')
-rw-r--r--apps/web/src/lib/timeline/audio-separation/index.ts29
1 files changed, 19 insertions, 10 deletions
diff --git a/apps/web/src/lib/timeline/audio-separation/index.ts b/apps/web/src/lib/timeline/audio-separation/index.ts
index 093edfbc..0ae1321f 100644
--- a/apps/web/src/lib/timeline/audio-separation/index.ts
+++ b/apps/web/src/lib/timeline/audio-separation/index.ts
@@ -1,4 +1,4 @@
-import { cloneAnimations, getChannel } from "@/lib/animation";
+import { cloneAnimations } from "@/lib/animation";
import type { ElementAnimations } from "@/lib/animation/types";
import type { MediaAsset } from "@/lib/media/types";
import { DEFAULTS } from "@/lib/timeline/defaults";
@@ -42,11 +42,9 @@ export function canExtractSourceAudio({
);
}
-export function canRecoverSourceAudio({
- element,
-}: {
- element: TimelineElement;
-}): element is VideoElement {
+export function canRecoverSourceAudio(
+ element: TimelineElement,
+): element is VideoElement {
return element.type === "video" && isSourceAudioSeparated({ element });
}
@@ -119,16 +117,27 @@ function cloneVolumeAnimations({
}: {
animations: ElementAnimations | undefined;
}): ElementAnimations | undefined {
- const volumeChannel = getChannel({ animations, propertyPath: "volume" });
- if (!volumeChannel) {
+ const volumeBinding = animations?.bindings.volume;
+ if (!volumeBinding) {
+ return undefined;
+ }
+
+ const subsetChannels = Object.fromEntries(
+ volumeBinding.components.flatMap((component) => {
+ const channel = animations?.channels[component.channelId];
+ return channel ? [[component.channelId, channel] as const] : [];
+ }),
+ );
+ if (Object.keys(subsetChannels).length === 0) {
return undefined;
}
return cloneAnimations({
animations: {
- channels: {
- volume: volumeChannel,
+ bindings: {
+ volume: volumeBinding,
},
+ channels: subsetChannels,
},
shouldRegenerateKeyframeIds: true,
});