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::defaultOutputDevice is not set

QAudioDeviceInfo::defaultOutputDevice is not set

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 2.0k Views
  • 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.
  • T Offline
    T Offline
    th.thielemann
    wrote on last edited by
    #1

    On Linux Ubuntu 12.04, Qt5.3, libasound2 installed I checked my audio configuration from Qt.

    • Devices are available
    • wav seems to be supported
      But QAudioDeviceInfo::defaultOutputDevice().deviceName(): is empty
    • can not play any sound from Qt (but from Linux)

    How to I set the output device?

    QAudioDeviceInfo.supportedCodecs:
    QAudioDeviceInfo::availableDevices(QAudio::AudioOutput):
    Device name:  "sysdefault:CARD=MID"
    Device name:  "front:CARD=MID,DEV=0"
    Device name:  "surround40:CARD=MID,DEV=0"
    Device name:  "surround41:CARD=MID,DEV=0"
    Device name:  "surround50:CARD=MID,DEV=0"
    Device name:  "surround51:CARD=MID,DEV=0"
    Device name:  "surround71:CARD=MID,DEV=0"
    Device name:  "hdmi:CARD=MID,DEV=0"
    Device name:  "hdmi:CARD=MID,DEV=1"
    Device name:  "hdmi:CARD=MID,DEV=2"
    Device name:  "dmix:CARD=MID,DEV=0"
    Device name:  "dmix:CARD=MID,DEV=3"
    Device name:  "dmix:CARD=MID,DEV=7"
    Device name:  "dmix:CARD=MID,DEV=8"
    Device name:  "dsnoop:CARD=MID,DEV=0"
    Device name:  "dsnoop:CARD=MID,DEV=3"
    Device name:  "dsnoop:CARD=MID,DEV=7"
    Device name:  "dsnoop:CARD=MID,DEV=8"
    Device name:  "hw:CARD=MID,DEV=0"
    Device name:  "hw:CARD=MID,DEV=3"
    Device name:  "hw:CARD=MID,DEV=7"
    Device name:  "hw:CARD=MID,DEV=8"
    Device name:  "plughw:CARD=MID,DEV=0"
    Device name:  "plughw:CARD=MID,DEV=3"
    Device name:  "plughw:CARD=MID,DEV=7"
    Device name:  "plughw:CARD=MID,DEV=8"
    Device name:  "default"
    QAudioDeviceInfo::defaultOutputDevice().deviceName():  ""
    QSoundEffect.supportedMimeTypes()
    mimeType:  "audio/x-wav"
    mimeType:  "audio/wav"
    mimeType:  "audio/wave"
    mimeType:  "audio/x-pn-wav"
    
    
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by SGaist
      #2

      Hi,

      IIRC Qt uses PulseAudio as backend on linux.

      Can you print what is the current list of available devices is ?

      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
      • T Offline
        T Offline
        th.thielemann
        wrote on last edited by
        #3

        Hi,

        the list of available devices is within my initial post.

        Regards

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

          How did you get that device list ?

          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
          • T Offline
            T Offline
            th.thielemann
            wrote on last edited by th.thielemann
            #5
            QString CAudioVideoReplay::supportedAudioCodecs()
            {
                QAudioDeviceInfo info;
                QStringList codecs = info.supportedCodecs();
                QString result;
                if (codecs.empty())  {
                    result.append("No Audio Codecs defined\n");
                }
                for (const QString& codec : codecs)  {
                    result.append(codec);
                    result.append("\n");
                }
                qDebug() << "supportedAudioCodecs=" << result;
                return result;
            }
            
            QString CAudioVideoReplay::availableAudioDevices()
            {
                QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
                QString result;
                if (devices.empty()) {
                    result.append("No Audio Devices defined\n");
                }
                for (const QAudioDeviceInfo& device : devices) {
                    QString row;
                    row.append("Device Name: " + device.deviceName() + "\n");
                    row.append("    Preferred Format: " + toString(device.preferredFormat()) + "\n");
                    result.append(row);
                }
                qDebug() << "availableAudioDevices=" << result;
                return result;
            }
            
            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Are you asking for the supported codecs of an empty QAudioDeviceInfo ?

              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