From 30ca8aa44a842d0bbf676fc0ca1fc0b34a053109 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 9 May 2022 18:51:26 +0100 Subject: [PATCH] Try to force 16bit int instead of 8bit uint --- audiohandler.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/audiohandler.cpp b/audiohandler.cpp index e79a9ea..f2e4c3c 100644 --- a/audiohandler.cpp +++ b/audiohandler.cpp @@ -97,6 +97,17 @@ bool audioHandler::init(audioSetup setup) } } + if (outFormat.sampleType() == QAudioFormat::UnSignedInt && outFormat.sampleSize()==8) { + outFormat.setSampleType(QAudioFormat::SignedInt); + outFormat.setSampleSize(16); + + if (!setup.port.isFormatSupported(outFormat)) { + qCritical(logAudio()) << (setup.isinput ? "Input" : "Output") << "Cannot request 16bit Signed samples, reverting to 8bit Unsigned"; + outFormat.setSampleType(QAudioFormat::UnSignedInt); + outFormat.setSampleSize(8); + } + } + /* if (outFormat.sampleType()==QAudioFormat::SignedInt) {