Create samples of audio and play the audio.
Unsolved
General and Desktop
-
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(audio_file.open(QIODevice::ReadOnly)) { QByteArray audio_data = audio_file.readAll(); audio_file.close(); QBuffer audio_buffer(&audio_data); audio_buffer.open(QIODevice::ReadOnly); QAudioFormat format; format.setSampleRate(1024); //format.setChannelCount(1); 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))); format.setSampleFormat(QAudioFormat::Int16); qDebug()<<outputstream; outputstream->start();
please consider all signals are intact and file_name is a QString declared before.
-
Hi and welcome to devnet,
Are you using Qt 6 ?
-
So I think you are looking for QAudioSink::start.