Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QAudioOutput



  • i am using qt 5.15 mingw

    QAudioFormat format;
    format.setChannelCount(1);
    format.setSampleRate(8000);
    format.setSampleSize(16);
    format.setCodec("audio/pcm");
    format.setByteOrder(QAudioFormat::LittleEndian);
    format.setSampleType(QAudioFormat::SignedInt);

    foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput))
    {
        qDebug() << " Device name: " << deviceInfo.deviceName();
    }
    
    QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
     qDebug() << " Device name22: " << info.deviceName();
    

    QAudioOutput *speaker = new QAudioOutput(QAudioDeviceInfo::defaultOutputDevice(),format);

    speaker iam getting null.

    i am running this code in windows

    QAudioDeviceInfo::defaultOutputDevice() name i am getting empty when i print deviceInfo.deviceName();
    i am getting windows speakers device

    what is the issue


  • Lifetime Qt Champion

    Hi,

    You might be requesting a format that is not supported by the default output of your system.

    Check your device and what they currently supported.


Log in to reply