No supported format in QAudioFormat
Solved
General and Desktop
-
Just a simple example:
#include <QCoreApplication> #include <QAudioSink> #include <QMediaDevices> #include <QDebug> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QAudioFormat format = QMediaDevices::defaultAudioOutput().preferredFormat(); if (!QMediaDevices::defaultAudioOutput().isFormatSupported(format)) { qWarning() << "Format not supported!"; } return a.exec(); }
And I get the output:
"Format not supported!"How is this possible? I'm on Windows 11, Qt 6.8.2, Qt Creator 15.0.1 (Enterprise).
I checked that QMediaDevices::defaultAudioOutput() outputs my device (I listen to music from it in the browser, everything works).
Maybe I somehow misunderstand how QAudioFormat works. But I tried a little bit to manually specify QAudioFormat properties, and it still showed that the format are not supported. -
S SGaist has marked this topic as solved