From 23980a5157ae93c9555971ab242c15e9ea0c82d1 Mon Sep 17 00:00:00 2001 From: Francesco Caracciolo <67018178+FrancescoCaracciolo@users.noreply.github.com> Date: Sat, 7 Dec 2024 17:33:24 +0100 Subject: [PATCH] Fix automatic tts not starting with avatar --- src/window.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/window.py b/src/window.py index eb210c6..eb19fea 100644 --- a/src/window.py +++ b/src/window.py @@ -1431,18 +1431,18 @@ def send_message(self): if self.translation_enabled and self.translation_handler in AVAILABLE_TRANSLATORS: translator = AVAILABLE_TRANSLATORS[self.translation_handler]["class"](self.settings, self.directory) if self.avatar_enabled and self.avatar_handler is not None: - self.avatar_handler.speak_with_tts(message, self.tts, translator) + tts_thread = threading.Thread(target=self.avatar_handler.speak_with_tts, args=(message, self.tts, translator)) else: if translator is not None: message = translator.translate(message) tts_thread = threading.Thread(target=self.tts.play_audio, args=(message, )) - tts_thread.start() - def restart_recording(): - if tts_thread is not None: - tts_thread.join() - GLib.idle_add(self.start_recording, self.recording_button) - if self.automatic_stt: - threading.Thread(target=restart_recording).start() + tts_thread.start() + def restart_recording(): + if tts_thread is not None: + tts_thread.join() + GLib.idle_add(self.start_recording, self.recording_button) + if self.automatic_stt: + threading.Thread(target=restart_recording).start() def create_streaming_message_label(self):