From 756099f753ea739028a23883de636b934076b3b6 Mon Sep 17 00:00:00 2001 From: Dpeta <69427753+Dpeta@users.noreply.github.com> Date: Fri, 17 Feb 2023 20:29:37 +0100 Subject: [PATCH] Revert "Check if audio device is output" This reverts commit 7f63c09141fc894383c664f10cc5fc5d80405eff. --- menus.py | 9 +++------ pesterchum.py | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/menus.py b/menus.py index 07b32be..5a4e9bc 100644 --- a/menus.py +++ b/menus.py @@ -1568,12 +1568,9 @@ class PesterOptions(QtWidgets.QDialog): current_audio_device = self.config.audioDevice() active_index = None try: - for i, device in enumerate(QtMultimedia.QMediaDevices.audioOutputs()): - self.audioDeviceBox.addItem(f"{device.description()}", device.id()) - if ( - device.id() == current_audio_device - and device.Mode == QtMultimedia.QAudioDevice.Mode.Output - ): + for i, output in enumerate(QtMultimedia.QMediaDevices.audioOutputs()): + self.audioDeviceBox.addItem(f"{output.description()}", output.id()) + if output.id() == current_audio_device: active_index = i if active_index is not None: self.audioDeviceBox.setCurrentIndex(active_index) diff --git a/pesterchum.py b/pesterchum.py index 1bb1cd6..9dc911f 100755 --- a/pesterchum.py +++ b/pesterchum.py @@ -2473,13 +2473,10 @@ class PesterWindow(MovingWindow): if "QtMultimedia" not in globals(): PchumLog.warning("Not using QtMultimedia, can't set audio device.") return - for device in QtMultimedia.QMediaDevices.audioOutputs(): - if ( - device_id == device.id() - and device.Mode == QtMultimedia.QAudioDevice.Mode.Output - ): + for output in QtMultimedia.QMediaDevices.audioOutputs(): + if device_id == output.id(): for sound in self.sounds: - sound.setAudioDevice(device) + sound.setAudioDevice(output) def canSetVolume(self): """Returns the state of volume setting capabilities."""