Important: Please read the Qt Code of Conduct -

Create samples of audio and play the audio.

  • Hi guys. I am really fed up with QAudioOutput class and not been able to find any helpful solution on the internet. Please help me in this topic.

    Query - I want to play the audio in the sample of 1024 (it would be good if it is a buffer that I can parse).

    Issue - QAudioOutput has no method start is the error I am facing. Also, need help with the use of QBuffer with QAudioOutput.

    My Code :

        QFile audio_file(file_name);
        if( {
            QByteArray audio_data = audio_file.readAll();
            QBuffer audio_buffer(&audio_data);
            QAudioFormat format;
            QAudioOutput *outputstream;
            outputstream = new QAudioOutput();
          //  connect(outputstream, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State)));
           // outputstream->startTimer(&audio_file);
            //connect(outputStream, SIGNAL(stateChanged(QAudio::State)), this, SLOT(audio_stateChanged(QAudio::State)));

    please consider all signals are intact and file_name is a QString declared before.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Are you using Qt 6 ?

  • Yes I am using QT 6.

  • Lifetime Qt Champion

    So I think you are looking for QAudioSink::start.

Log in to reply