Why can't I open my default audio input?
-
Using Qt 5.15 on Windows 10 Pro, this code
const auto deviceInfos = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
for (const QAudioDeviceInfo &deviceInfo : deviceInfos)
qDebug() << "Device name: " << deviceInfo.deviceName();
qDebug()<< "Default audio input is " << QAudioDeviceInfo::defaultInputDevice().deviceName();
QAudioFormat format;
format.setCodec("audio/pcm");
format.setChannelCount(2);
format.setSampleRate(44100);
format.setSampleType(QAudioFormat::SignedInt);
format.setSampleSize(16);
format.setByteOrder(QAudioFormat::LittleEndian);
QAudioDeviceInfo info(QAudioDeviceInfo::defaultInputDevice());
if (info.isFormatSupported(format))
qDebug() << "Format IS supported";
else
qDebug() << "Format is NOT supported";
QAudioInput *audio = new QAudioInput(format, this);
Q_ASSERT(audio);produces
Device name: "Line In (Realtek(R) Audio)"
Default audio input is "Default Input Device"
Format IS supportedbut when I add
QIODevice *dev = audio->start();it produces
avcore\audiocore\client\audioclient\audioclientcore.cpp(1501)\AUDIOSES.DLL!00...
QAudioInput: failed to open audio deviceAm I doing something wrong?
-
Hi and welcome to devnet,
Might be a silly question but do you have any other application that might be using it ?