From 0755b41cf08c6fecea5fe9b3d3d9f5a537e592b0 Mon Sep 17 00:00:00 2001 From: misygauziya Date: Thu, 13 Jul 2023 10:45:15 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B9=E3=83=94=E3=83=BC=E3=82=AB=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=81=A4=E3=81=84=E3=81=A6=E6=97=A2=E5=AE=9A=E3=83=87?= =?UTF-8?q?=E3=83=90=E3=82=A4=E3=82=B9=E4=BB=A5=E5=A4=96=E3=82=92=E9=81=B8?= =?UTF-8?q?=E6=8A=9E=E3=81=97=E3=81=9F=E6=99=82=E3=81=ABERROR=E3=81=8C?= =?UTF-8?q?=E5=87=BA=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VRCT.py | 4 +++- window_config.py | 13 +++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/VRCT.py b/VRCT.py index 3270081f..9915b82c 100644 --- a/VRCT.py +++ b/VRCT.py @@ -161,7 +161,9 @@ class App(CTk): if "CHOICE_SPEAKER_DEVICE" in config.keys(): if config["CHOICE_SPEAKER_DEVICE"] in [device["name"] for device in get_output_device_list()]: - self.CHOICE_SPEAKER_DEVICE = config["CHOICE_SPEAKER_DEVICE"] + speaker_device = [device for device in get_output_device_list() if device["name"] == config["CHOICE_SPEAKER_DEVICE"]][0] + if get_default_output_device()["index"] == speaker_device["index"]: + self.CHOICE_SPEAKER_DEVICE = config["CHOICE_SPEAKER_DEVICE"] if "INPUT_SPEAKER_VOICE_LANGUAGE" in config.keys(): if config["INPUT_SPEAKER_VOICE_LANGUAGE"] in list(transcription_lang.keys()): self.INPUT_SPEAKER_VOICE_LANGUAGE = config["INPUT_SPEAKER_VOICE_LANGUAGE"] diff --git a/window_config.py b/window_config.py index 747f21f8..481acea6 100644 --- a/window_config.py +++ b/window_config.py @@ -301,10 +301,14 @@ class ToplevelWindowConfig(CTkToplevel): save_json(self.parent.PATH_CONFIG, "INPUT_MIC_WORD_FILTER", self.parent.INPUT_MIC_WORD_FILTER) def optionmenu_input_speaker_device_callback(self, choice): - self.parent.CHOICE_SPEAKER_DEVICE = choice - save_json(self.parent.PATH_CONFIG, "CHOICE_SPEAKER_DEVICE", self.parent.CHOICE_SPEAKER_DEVICE) - self.checkbox_input_speaker_threshold_check.deselect() - self.checkbox_input_speaker_threshold_check_callback() + speaker_device = [device for device in get_output_device_list() if device["name"] == choice][0] + if get_default_output_device()["index"] == speaker_device["index"]: + self.parent.CHOICE_SPEAKER_DEVICE = choice + save_json(self.parent.PATH_CONFIG, "CHOICE_SPEAKER_DEVICE", self.parent.CHOICE_SPEAKER_DEVICE) + else: + print_textbox(self.parent.textbox_message_log, "Windows playback device and selected device do not match. Change the Windows playback device.", "ERROR") + print_textbox(self.parent.textbox_message_system_log, "Windows playback device and selected device do not match. Change the Windows playback device.", "ERROR") + self.optionmenu_input_speaker_device.configure(variable=StringVar(value=self.parent.CHOICE_SPEAKER_DEVICE)) def optionmenu_input_speaker_voice_language_callback(self, choice): self.parent.INPUT_SPEAKER_VOICE_LANGUAGE = choice @@ -339,6 +343,7 @@ class ToplevelWindowConfig(CTkToplevel): self.speaker_energy_plot_progressbar.start() else: print_textbox(self.parent.textbox_message_log, "Windows playback device and selected device do not match. Change the Windows playback device.", "ERROR") + print_textbox(self.parent.textbox_message_system_log, "Windows playback device and selected device do not match. Change the Windows playback device.", "ERROR") self.checkbox_input_speaker_threshold_check.deselect() else: if self.speaker_energy_get_progressbar != None: