TTS: Call module worker when audio stops playing #3371
| @@ -30,6 +30,7 @@ import { GoogleTranslateTtsProvider } from './google-translate.js'; | ||
| 30 | 30 | export { talkingAnimation }; |
| 31 | 31 | |
| 32 | 32 | const UPDATE_INTERVAL = 1000; |
| 33 | +const wrapper = new ModuleWorkerWrapper(moduleWorker); | |
| 33 | 34 | |
| 34 | 35 | let voiceMapEntries = []; |
| 35 | 36 | let voiceMap = {}; // {charName:voiceid, charName2:voiceid2} |
| @@ -406,6 +407,7 @@ function completeCurrentAudioJob() { | ||
| 406 | 407 | currentAudioJob = null; |
| 407 | 408 | talkingAnimation(false); //stop lip animation |
| 408 | 409 | // updateUiPlayState(); |
| 410 | + wrapper.update(); | |
| 409 | 411 | } |
| 410 | 412 | |
| 411 | 413 | /** |
| @@ -1219,7 +1221,6 @@ jQuery(async function () { | ||
| 1219 | 1221 | loadSettings(); // Depends on Extension Controls and loadTtsProvider |
| 1220 | 1222 | loadTtsProvider(extension_settings.tts.currentProvider); // No dependencies |
| 1221 | 1223 | addAudioControl(); // Depends on Extension Controls |
| 1222 | - const wrapper = new ModuleWorkerWrapper(moduleWorker); | |
| 1223 | 1224 | setInterval(wrapper.update.bind(wrapper), UPDATE_INTERVAL); // Init depends on all the things |
| 1224 | 1225 | eventSource.on(event_types.MESSAGE_SWIPED, resetTtsPlayback); |
| 1225 | 1226 | eventSource.on(event_types.CHAT_CHANGED, onChatChanged); |