Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. "QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)" takes a lot of time.

"QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)" takes a lot of time.

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 400 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • GimInGZG Offline
    GimInGZG Offline
    GimInGZ
    wrote on last edited by
    #1

    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:
    262b9642-07d0-4bab-b7f3-8e6194638412-image.png

    Qt version:
    Qt 5.13.0 MSVC2017 32bit

    OS: Windows 10 (10.0.18362)

    slow and stupid.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • GimInGZG Offline
        GimInGZG Offline
        GimInGZ
        wrote on last edited by
        #3

        Hi. thank for your reply.
        I dont know what happen……I haven't do anythings but it work fine now.😰
        960f0cf5-15ac-4887-8446-ace840b9918f-image.png

        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)

        3dbfc85c-cf88-4034-9f8a-54a68e3d73c1-image.png

        slow and stupid.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved