From 084e78e809200c93f3290f82c33b0e69d40da232 Mon Sep 17 00:00:00 2001 From: Lars Toenning Date: Tue, 23 Jun 2026 20:43:40 +0200 Subject: [PATCH] fix: Do not guess a possible audio format This might have some side effects on other parts of swift that needs to be checked first. We should handle this in a different issue. Note: This was done in pre-Qt6 --- src/sound/audioutilities.cpp | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/src/sound/audioutilities.cpp b/src/sound/audioutilities.cpp index 993e7db8d..f6cc4d368 100644 --- a/src/sound/audioutilities.cpp +++ b/src/sound/audioutilities.cpp @@ -82,39 +82,7 @@ namespace swift::sound if (!defDevice.isFormatSupported(format)) { - // Try to find a supported format - QAudioFormat adjustedFormat = defDevice.preferredFormat(); - - // Try to keep as many original settings as possible - adjustedFormat.setSampleRate(format.sampleRate()); - adjustedFormat.setChannelCount(format.channelCount()); - adjustedFormat.setSampleFormat(format.sampleFormat()); - - if (defDevice.isFormatSupported(adjustedFormat)) - { - format = adjustedFormat; - return defDevice; - } - - // Fallback: Try with preferred format's sample rate but keep other settings - adjustedFormat = defDevice.preferredFormat(); - adjustedFormat.setChannelCount(format.channelCount()); - adjustedFormat.setSampleFormat(format.sampleFormat()); - - if (defDevice.isFormatSupported(adjustedFormat)) - { - format = adjustedFormat; - return defDevice; - } - - // Last resort: Use the device's preferred format entirely - if (defDevice.isFormatSupported(defDevice.preferredFormat())) - { - format = defDevice.preferredFormat(); - return defDevice; - } - - // Device doesn't support any reasonable format + // Device doesn't support the required format return {}; } return defDevice;