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';
30export { talkingAnimation };30export { talkingAnimation };
3131
32const UPDATE_INTERVAL = 1000;32const UPDATE_INTERVAL = 1000;
33const wrapper = new ModuleWorkerWrapper(moduleWorker);
3334
34let voiceMapEntries = [];35let voiceMapEntries = [];
35let voiceMap = {}; // {charName:voiceid, charName2:voiceid2}36let voiceMap = {}; // {charName:voiceid, charName2:voiceid2}
@@ -406,6 +407,7 @@ function completeCurrentAudioJob() {
406 currentAudioJob = null;407 currentAudioJob = null;
407 talkingAnimation(false); //stop lip animation408 talkingAnimation(false); //stop lip animation
408 // updateUiPlayState();409 // updateUiPlayState();
410 wrapper.update();
409}411}
410412
411/**413/**
@@ -1219,7 +1221,6 @@ jQuery(async function () {
1219 loadSettings(); // Depends on Extension Controls and loadTtsProvider1221 loadSettings(); // Depends on Extension Controls and loadTtsProvider
1220 loadTtsProvider(extension_settings.tts.currentProvider); // No dependencies1222 loadTtsProvider(extension_settings.tts.currentProvider); // No dependencies
1221 addAudioControl(); // Depends on Extension Controls1223 addAudioControl(); // Depends on Extension Controls
1222 const wrapper = new ModuleWorkerWrapper(moduleWorker);
1223 setInterval(wrapper.update.bind(wrapper), UPDATE_INTERVAL); // Init depends on all the things1224 setInterval(wrapper.update.bind(wrapper), UPDATE_INTERVAL); // Init depends on all the things
1224 eventSource.on(event_types.MESSAGE_SWIPED, resetTtsPlayback);1225 eventSource.on(event_types.MESSAGE_SWIPED, resetTtsPlayback);
1225 eventSource.on(event_types.CHAT_CHANGED, onChatChanged);1226 eventSource.on(event_types.CHAT_CHANGED, onChatChanged);