From de445998277d3a6e1e8d8c1a1c3e13ebb945f192 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Fri, 20 Sep 2024 05:35:51 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=8D=EF=B8=8F[Update]=20Model:=20Auto?= =?UTF-8?q?=20Mic/Speaker=20Select=20ON=E6=99=82=E3=81=ABDefault=20Device?= =?UTF-8?q?=E3=82=92UI=E3=81=AB=E3=82=BB=E3=83=83=E3=83=88=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/transcription/transcription_utils.py | 12 +++++++----- src-python/webui_controller.py | 6 ++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src-python/models/transcription/transcription_utils.py b/src-python/models/transcription/transcription_utils.py index 2b51ec31..e00e03eb 100644 --- a/src-python/models/transcription/transcription_utils.py +++ b/src-python/models/transcription/transcription_utils.py @@ -125,11 +125,7 @@ class DeviceManager: sleep(1) enumerator.UnregisterEndpointNotificationCallback(cb) self.update() - - if self.callback_default_input_device is not None: - self.callback_default_input_device(self.default_input_device["host"]["name"], self.default_input_device["device"]["name"]) - if self.callback_default_output_device is not None: - self.callback_default_output_device(self.default_output_device["device"]["name"]) + self.noticeDefaultDevice() cb = Client() enumerator = AudioUtilities.GetDeviceEnumerator() @@ -160,6 +156,12 @@ class DeviceManager: def clearCallbackDefaultOutputDevice(self): self.callback_default_output_device = None + def noticeDefaultDevice(self): + if self.callback_default_input_device is not None: + self.callback_default_input_device(self.default_input_device["host"]["name"], self.default_input_device["device"]["name"]) + if self.callback_default_output_device is not None: + self.callback_default_output_device(self.default_output_device["device"]["name"]) + def getInputDevices(self): return self.input_devices diff --git a/src-python/webui_controller.py b/src-python/webui_controller.py index 734cd796..bda7956f 100644 --- a/src-python/webui_controller.py +++ b/src-python/webui_controller.py @@ -552,9 +552,10 @@ def getAutoMicSelect(*args, **kwargs) -> dict: return {"status":200, "result":config.AUTO_MIC_SELECT} def setEnableAutoMicSelect(data, action, *args, **kwargs) -> dict: + config.AUTO_MIC_SELECT = True update_device = UpdateSelectedMicDevice(action) device_manager.setCallbackDefaultInputDevice(update_device.set) - config.AUTO_MIC_SELECT = True + device_manager.noticeDefaultDevice() return {"status":200, "result":config.AUTO_MIC_SELECT} def setDisableAutoMicSelect(*args, **kwargs) -> dict: @@ -710,9 +711,10 @@ def getAutoSpeakerSelect(*args, **kwargs) -> dict: return {"status":200, "result":config.AUTO_SPEAKER_SELECT} def setEnableAutoSpeakerSelect(data, action, *args, **kwargs) -> dict: + config.AUTO_SPEAKER_SELECT = True update_device = UpdateSelectedSpeakerDevice(action) device_manager.setCallbackDefaultOutputDevice(update_device.set) - config.AUTO_SPEAKER_SELECT = True + device_manager.noticeDefaultDevice() return {"status":200, "result":config.AUTO_SPEAKER_SELECT} def setDisableAutoSpeakerSelect(*args, **kwargs) -> dict: