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 misbehaving in Windows 10
Forum Updated to NodeBB v4.3 + New Features

QAudioDeviceInfo misbehaving in Windows 10

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 837 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.
  • CentralScrutinizerC Offline
    CentralScrutinizerC Offline
    CentralScrutinizer
    wrote on last edited by
    #1

    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
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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

      CentralScrutinizerC 3 Replies Last reply
      0
      • SGaistS SGaist

        Hi,

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

        CentralScrutinizerC Offline
        CentralScrutinizerC Offline
        CentralScrutinizer
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

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

          CentralScrutinizerC Offline
          CentralScrutinizerC Offline
          CentralScrutinizer
          wrote on last edited by
          #4

          @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
          0
          • SGaistS SGaist

            Hi,

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

            CentralScrutinizerC Offline
            CentralScrutinizerC Offline
            CentralScrutinizer
            wrote on last edited by
            #5

            @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
            0
            • CentralScrutinizerC Offline
              CentralScrutinizerC Offline
              CentralScrutinizer
              wrote on last edited by
              #6

              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
              1

              • Login

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