Duplicate device name returned from QAudioDeviceInfo::availableDevices
-
Hi,
I am trying to list the available devices on my system and output them:
QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
for (const QAudioDeviceInfo & dev : devices)
output(dev.deviceName());I don't understand why two devices are returned on my system with the same name but different properties:
Microphone (High Definition Audio Device)
sample rates: 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200, 96000, 192000,
channel counts: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
sample size: 8, 16, 24, 32, 48, 64,
codecs: audio/pcm,
byte order: 1,
sample type: 1, 2, 3,Microphone (High Definition Audio Device)
sample rates: 44100,
channel counts: 2,
sample size: 8, 16, 24, 32, 64,
codecs: audio/pcm,
byte order: 1,
sample type: 1, 3,The documentation (https://doc.qt.io/qt-5/qaudiodeviceinfo.html#deviceName) states that the device name should be unique.
Of course I can workaround the problem somehow, I was just thinking if I don't understand something or if this is a qt but I should report.(a little bit off-topic: how do I convert the enum values to strings ? Of course I searched how to do this but all solutions I found required the Q_ENUM macro but the macro is not present in the QAudioFormat class where the enums are declared).
I am on Windows10/MSVC2019 16.5.2/Qt 5.14.2 msvc2017_64
Any help is appreciated.
Regards,
Henning -
Hi,
I am trying to list the available devices on my system and output them:
QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
for (const QAudioDeviceInfo & dev : devices)
output(dev.deviceName());I don't understand why two devices are returned on my system with the same name but different properties:
Microphone (High Definition Audio Device)
sample rates: 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200, 96000, 192000,
channel counts: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
sample size: 8, 16, 24, 32, 48, 64,
codecs: audio/pcm,
byte order: 1,
sample type: 1, 2, 3,Microphone (High Definition Audio Device)
sample rates: 44100,
channel counts: 2,
sample size: 8, 16, 24, 32, 64,
codecs: audio/pcm,
byte order: 1,
sample type: 1, 3,The documentation (https://doc.qt.io/qt-5/qaudiodeviceinfo.html#deviceName) states that the device name should be unique.
Of course I can workaround the problem somehow, I was just thinking if I don't understand something or if this is a qt but I should report.(a little bit off-topic: how do I convert the enum values to strings ? Of course I searched how to do this but all solutions I found required the Q_ENUM macro but the macro is not present in the QAudioFormat class where the enums are declared).
I am on Windows10/MSVC2019 16.5.2/Qt 5.14.2 msvc2017_64
Any help is appreciated.
Regards,
Henning@_Henning_ said in Duplicate device name returned from QAudioDeviceInfo::availableDevices:
how do I convert the enum values to strings ?
Not elegant but works:
QString strValue; switch(value) { case ENUM_VALUE_1: strValue = "ENUM_VALUE_1"; break; case... }