TTS: Call module worker when audio stops playing #3371

4f456b2b80b9dc5ddf5c9c9408229137f7d5b562

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +2 -1Showing whitespace changes
public/scripts/extensions/tts/index.js+2 -1
@@ -30,6 +30,7 @@ import { GoogleTranslateTtsProvider } from './google-translate.js';
3030export { talkingAnimation };
3131
3232const UPDATE_INTERVAL = 1000;
33+const wrapper = new ModuleWorkerWrapper(moduleWorker);
3334
3435let voiceMapEntries = [];
3536let voiceMap = {}; // {charName:voiceid, charName2:voiceid2}
@@ -406,6 +407,7 @@ function completeCurrentAudioJob() {
406407 currentAudioJob = null;
407408 talkingAnimation(false); //stop lip animation
408409 // updateUiPlayState();
410+ wrapper.update();
409411}
410412
411413/**
@@ -1219,7 +1221,6 @@ jQuery(async function () {
12191221 loadSettings(); // Depends on Extension Controls and loadTtsProvider
12201222 loadTtsProvider(extension_settings.tts.currentProvider); // No dependencies
12211223 addAudioControl(); // Depends on Extension Controls
1222- const wrapper = new ModuleWorkerWrapper(moduleWorker);
12231224 setInterval(wrapper.update.bind(wrapper), UPDATE_INTERVAL); // Init depends on all the things
12241225 eventSource.on(event_types.MESSAGE_SWIPED, resetTtsPlayback);
12251226 eventSource.on(event_types.CHAT_CHANGED, onChatChanged);