From 9fec82bd310d5d8e2868ef7e9ed4ff626e9515e9 Mon Sep 17 00:00:00 2001 From: joe Date: Fri, 11 Aug 2023 14:43:53 +0900 Subject: [PATCH] Add / Update talking lips animations --- public/scripts/extensions/tts/index.js | 5 +++-- public/scripts/extensions/tts/system.js | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/public/scripts/extensions/tts/index.js b/public/scripts/extensions/tts/index.js index fba20a655..d1a4d8bef 100644 --- a/public/scripts/extensions/tts/index.js +++ b/public/scripts/extensions/tts/index.js @@ -9,6 +9,7 @@ import { SystemTtsProvider } from './system.js' import { NovelTtsProvider } from './novel.js' import { power_user } from '../../power-user.js' import { rvcVoiceConversion } from "../rvc/index.js" +export { talkingAnimation }; const UPDATE_INTERVAL = 1000 @@ -177,6 +178,7 @@ function talkingAnimation(switchValue) { // Handle the error here or simply ignore it to prevent logging } } + updateUiAudioPlayState() } function resetTtsPlayback() { @@ -305,10 +307,8 @@ function updateUiAudioPlayState() { // Give user feedback that TTS is active by setting the stop icon if processing or playing if (!audioElement.paused || isTtsProcessing()) { img = 'fa-solid fa-stop-circle extensionsMenuExtensionButton' - talkingAnimation(true) } else { img = 'fa-solid fa-circle-play extensionsMenuExtensionButton' - talkingAnimation(false) } $('#tts_media_control').attr('class', img); } else { @@ -345,6 +345,7 @@ function completeCurrentAudioJob() { audioQueueProcessorReady = true currentAudioJob = null lastAudioPosition = 0 + talkingAnimation(false) //stop lip animation // updateUiPlayState(); } diff --git a/public/scripts/extensions/tts/system.js b/public/scripts/extensions/tts/system.js index acbf3d4e9..5e8c5f2b0 100644 --- a/public/scripts/extensions/tts/system.js +++ b/public/scripts/extensions/tts/system.js @@ -1,5 +1,6 @@ import { isMobile } from "../../RossAscends-mods.js"; import { getPreviewString } from "./index.js"; +import { talkingAnimation } from './index.js'; export { SystemTtsProvider } @@ -69,6 +70,7 @@ var speechUtteranceChunker = function (utt, settings, callback) { //placing the speak invocation inside a callback fixes ordering and onend issues. setTimeout(function () { speechSynthesis.speak(newUtt); + talkingAnimation(true); }, 0); }; @@ -221,6 +223,7 @@ class SystemTtsProvider { //some code to execute when done resolve(silence); console.log('System TTS done'); + talkingAnimation(false); }); }); }