Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Solved QAudioDeviceInfo misbehaving in Windows 10

    General and Desktop
    2
    6
    425
    Loading More Posts
    • 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.
    • CentralScrutinizer
      CentralScrutinizer last edited by

      Hi All,

      I have a very strange problem that doesn't occur when I run my application in release mode inside QtCreator, but only once I package the application and run it from it's own directory (with all its dependencies properly packaged with it). The problem concerns querying the system for the default audio device using QAudioDeviceInfo::defaultOutputDevice(). This works just fine as I said when running inside the IDE.

      For example this bit of code:

         QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
         if (info.isNull())
         {
             qDebug() << "Audio Info is Null " <<  info.deviceName();
         }
         if (!info.isFormatSupported(_format))
         {
             qWarning() << "Audio output format not supported by backend, cannot play audio. " << info.deviceName();
      
             qDebug()<<info.supportedCodecs();
             qDebug()<<info.supportedByteOrders();
             qDebug()<<info.supportedChannelCounts();
             qDebug()<<info.supportedSampleRates();
             qDebug()<<info.supportedSampleSizes();
         }
         else
         {
             qDebug() << "Audio Info is OK! " <<  info.deviceName();
         }
      

      When run in the IDE yields:

      Audio Info is OK!  "Speakers (Realtek High Definition Audio)"
      

      Yet in my GUI app (doctored to have console output) I get:

      Audio Info is Null  ""
      Audio output format not supported by backend, cannot play audio.  ""
      ()
      ()
      ()
      ()
      ()
      

      Very frustrating to try to debug this. I don't have much knowledge of the underlying audio system in Windows, so please if there's something I need to know about the backend, let me know (Qt version is 5.7, using MinGW to build)

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        Are you using windeployqt to put together the dependencies of your application ?
        Did you deploy the QtMultimedia plugins ?

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

        CentralScrutinizer 3 Replies Last reply Reply Quote 0
        • CentralScrutinizer
          CentralScrutinizer @SGaist last edited by

          @SGaist Yes. Without that the application would crash on startup.

          1 Reply Last reply Reply Quote 0
          • CentralScrutinizer
            CentralScrutinizer @SGaist last edited by

            @SGaist Oh... wait... you didn't say library you said plugins... are there plugins to deploy as well? If so it seems windeployqt is not picking them up. Actually I don't think it picks up Qt5Mulimedia dll on its own either come to think of it, i had to add that manually to the package in my .pro files...

            SO what else needs to be in there?

            1 Reply Last reply Reply Quote 0
            • CentralScrutinizer
              CentralScrutinizer @SGaist last edited by

              @SGaist Yes, plugins was the magic word. I added QTDIR/plugins/audio to my package and it works now. So why does windeployqt not pick up the QtMultimedia stuff?

              1 Reply Last reply Reply Quote 0
              • CentralScrutinizer
                CentralScrutinizer last edited by

                For those wondering, I had to add the --multimedia option to the windeployqt command. I didn't realize there were separate options in windeployqt for each Qt module... guess I should have read the docs more carefully! Thanks to SGaist.

                1 Reply Last reply Reply Quote 1
                • First post
                  Last post