Unsolved "QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)" takes a lot of time.
-
When I use it directly in the main thread, UI will stuck by it for a long time.
What should I do?Truly grateful for your help.
code:
#include <QApplication> #include <QDateTime> #include <QAudioDeviceInfo> #include <QDebug> int main(int argc, char *argv[]) { QApplication a(argc, argv); QTime time; time.start(); QAudioDeviceInfo::availableDevices(QAudio::AudioOutput); qInfo() << time.restart(); QAudioDeviceInfo::availableDevices(QAudio::AudioOutput); qInfo() << time.restart(); QAudioDeviceInfo::availableDevices(QAudio::AudioOutput); qInfo() << time.restart(); return a.exec(); }
output:
Qt version:
Qt 5.13.0 MSVC2017 32bitOS: Windows 10 (10.0.18362)
-
Hi and welcome to devnet,
What kind of devices do you have on your machine ? How many of them ?
Note that QtMultimedia uses platform specific APIs in its backends so it might be something related to your Windows installation. -
Hi. thank for your reply.
I dont know what happen……I haven't do anythings but it work fine now.😰
I have these devices on my machine.
output devices:
Speakers(USB Audio Device)
Speakers/Headset(Realtek High Definition Audio)input devices:
Microphone(USB Audio Device)
Microphone(Realtek USB2.0 MIC)
Stereo Mixer(Realtek High Definition Audio)
Microphone Array(Realtek High Definition Audio) -
You may have just had a system glitch at some point. Maybe a virus scanner or something like that running while you were hacking and hogging resources.