Qt Forum

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

    Call for Presentations - Qt World Summit

    Unsolved QAudioDeviceInfo::defaultOutputDevice is not set

    General and Desktop
    2
    6
    1661
    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.
    • T
      th.thielemann last edited by

      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 Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by SGaist

        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 Reply Quote 0
        • T
          th.thielemann last edited by

          Hi,

          the list of available devices is within my initial post.

          Regards

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

            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 Reply Quote 0
            • T
              th.thielemann last edited by th.thielemann

              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 Reply Quote 0
              • SGaist
                SGaist Lifetime Qt Champion last edited by

                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 Reply Quote 0
                • First post
                  Last post