QAudioDeviceInfo::defaultOutputDevice is not set



  • 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"
    
    
    

  • Lifetime Qt Champion

    Hi,

    IIRC Qt uses PulseAudio as backend on linux.

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



  • Hi,

    the list of available devices is within my initial post.

    Regards


  • Lifetime Qt Champion

    How did you get that device list ?



  • 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;
    }
    

  • Lifetime Qt Champion

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.