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: