From 3ee9872ecc1633e5ea7bce4625d130106b99c791 Mon Sep 17 00:00:00 2001 From: Quicksticks-oss Date: Mon, 15 Apr 2024 16:28:42 -0400 Subject: [PATCH 1/3] made audio only play when in playmode. --- app/pages/PageEnigma/js/timeline.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/pages/PageEnigma/js/timeline.ts b/app/pages/PageEnigma/js/timeline.ts index d9f637da19..5f9c578f76 100644 --- a/app/pages/PageEnigma/js/timeline.ts +++ b/app/pages/PageEnigma/js/timeline.ts @@ -511,7 +511,8 @@ export class TimeLine { } } else if ( element.type === ClipType.AUDIO && - element.group !== ClipGroup.CHARACTER + element.group !== ClipGroup.CHARACTER && + this.is_playing ) { if (this.scrubber_frame_position + 1 >= element.length) { this.audio_engine.stopClip(element.media_id); @@ -520,7 +521,8 @@ export class TimeLine { } } else if ( element.type === ClipType.AUDIO && - element.group === ClipGroup.CHARACTER + element.group === ClipGroup.CHARACTER && + this.is_playing ) { // we will remove this when we know which group it will come from character + audio === lip sync audio. if (this.scrubber_frame_position + 1 >= element.length) { From ce268e64382124aaf4e8f8f28efc4fa888d34de5 Mon Sep 17 00:00:00 2001 From: Quicksticks-oss Date: Mon, 15 Apr 2024 16:39:12 -0400 Subject: [PATCH 2/3] add stop playback. --- app/pages/PageEnigma/js/editor.ts | 35 ++++++++++++++++++----------- app/pages/PageEnigma/js/timeline.ts | 2 +- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/app/pages/PageEnigma/js/editor.ts b/app/pages/PageEnigma/js/editor.ts index 4d6ffc1d7a..db344d7956 100644 --- a/app/pages/PageEnigma/js/editor.ts +++ b/app/pages/PageEnigma/js/editor.ts @@ -378,7 +378,7 @@ class Editor { console.log(result); } - public async testTestTimelineEvents() {} + public async testTestTimelineEvents() { } public async loadScene(scene_media_token: string) { this.dispatchAppUiState({ @@ -854,10 +854,10 @@ class Editor { audioSegment, "-filter_complex", "[1:a]adelay=" + - startTime * 1000 + - "|" + - startTime * 1000 + - "[a1];[0:a][a1]amix=inputs=2[a]", + startTime * 1000 + + "|" + + startTime * 1000 + + "[a1];[0:a][a1]amix=inputs=2[a]", "-map", "[a]", `${itteration}final_tmp.wav`, @@ -1107,6 +1107,7 @@ class Editor { this.frame_buffer = []; this.render_timer = 0; this.activeScene.renderMode(this.rendering); + this.timeline.scrubber_frame_position = 0; if (this.activeScene.hot_items) { this.activeScene.hot_items.forEach((element) => { element.visible = false; @@ -1117,15 +1118,23 @@ class Editor { startPlayback() { this.updateLoad(25, "Starting Processing"); - this.timeline.is_playing = true; - this.timeline.scrubber_frame_position = 0; - if (!this.camera_person_mode) { - this.switchCameraView(); + if (!this.rendering && this.timeline.is_playing) { + this.timeline.is_playing = false; + this.timeline.scrubber_frame_position = 0; + this.timeline.resetScene(); } - if (this.activeScene.hot_items) { - this.activeScene.hot_items.forEach((element) => { - element.visible = false; - }); + else { + + this.timeline.is_playing = true; + this.timeline.scrubber_frame_position = 0; + if (!this.camera_person_mode) { + this.switchCameraView(); + } + if (this.activeScene.hot_items) { + this.activeScene.hot_items.forEach((element) => { + element.visible = false; + }); + } } } diff --git a/app/pages/PageEnigma/js/timeline.ts b/app/pages/PageEnigma/js/timeline.ts index 5f9c578f76..4150ccb368 100644 --- a/app/pages/PageEnigma/js/timeline.ts +++ b/app/pages/PageEnigma/js/timeline.ts @@ -432,7 +432,7 @@ export class TimeLine { this.is_playing = true; } - private async resetScene() { + public async resetScene() { for (const element of this.timeline_items) { if (element.type === ClipType.TRANSFORM) { const object = this.scene.get_object_by_uuid(element.object_uuid); From 2c9e227ccc37c83bf58768e55ddb7b9864bc8e0a Mon Sep 17 00:00:00 2001 From: Quicksticks-oss Date: Mon, 15 Apr 2024 21:16:25 -0400 Subject: [PATCH 3/3] Fixed lipsync and audio engine. --- app/pages/PageEnigma/js/editor.ts | 8 ++++++++ app/pages/PageEnigma/js/timeline.ts | 3 +++ 2 files changed, 11 insertions(+) diff --git a/app/pages/PageEnigma/js/editor.ts b/app/pages/PageEnigma/js/editor.ts index db344d7956..2d0501d12a 100644 --- a/app/pages/PageEnigma/js/editor.ts +++ b/app/pages/PageEnigma/js/editor.ts @@ -1121,7 +1121,15 @@ class Editor { if (!this.rendering && this.timeline.is_playing) { this.timeline.is_playing = false; this.timeline.scrubber_frame_position = 0; + this.timeline.current_time = 0; + this.timeline.stepFrame(0); this.timeline.resetScene(); + this.switchCameraView(); + if (this.activeScene.hot_items) { + this.activeScene.hot_items.forEach((element) => { + element.visible = true; + }); + } } else { diff --git a/app/pages/PageEnigma/js/timeline.ts b/app/pages/PageEnigma/js/timeline.ts index 4150ccb368..3c27c7a590 100644 --- a/app/pages/PageEnigma/js/timeline.ts +++ b/app/pages/PageEnigma/js/timeline.ts @@ -453,6 +453,9 @@ export class TimeLine { element.type === ClipType.AUDIO && element.group === ClipGroup.CHARACTER ) { + this.lipSync_engine.clips[ + element.object_uuid + element.media_id + ].stop(); this.lipSync_engine.clips[ element.object_uuid + element.media_id ].reset();