QAudioOutput start method not supported - QT6
-
Is the start method not available in QT6 for QAudioOutput? It doesn't take it when I try to implement it for audio playing.
-
@harish__rajora said in QAudioOutput start method not supported - QT6:
It doesn't take it when I try to implement it for audio playing.
What does this mean?
-
QAudioOutput *outputstream;
outputstream = new QAudioOutput(this);I want to do outputstream->start() but it doesn't happen.
I am very new. Any help is appreciated.
-
@harish__rajora said in QAudioOutput start method not supported - QT6:
but it doesn't happen.
Again: what does this mean?
Please provide some code - simply instantiating a QAudioOutput and calling start() will do nothing.
-
file_name = QFileDialog::getOpenFileName(this, "Open a file"); if (!file_name.isEmpty()){ QLabel *fileName = findChild<QLabel*>("fileName"); fileName->setText(file_name); cout<<file_name.toStdString(); QFile audio_file(file_name); if(audio_file.open(QIODevice::ReadOnly)) { readheader(); audio_data = audio_file.readAll(); audio_file.close(); QDataStream audio_ds(audio_data); int val = 0; audio_ds>>val; audio_buffer = new QBuffer(&temporary_audio_array); int initial_byte = 0; temporary_audio_array.clear(); audio_buffer->reset(); for(int i = initial_byte; i < initial_byte + 80000; i++) temporary_audio_array.append(audio_data[i]); qDebug()<<"The size of audio_buffer is"<<audio_data.size(); audio_buffer->seek(0); QAudioFormat format = QAudioFormat(); cout << "Filled buffer" << endl; QAudioOutput *outputstream; outputstream = new QAudioOutput(this); format.setSampleFormat(QAudioFormat::Int16); myplayer->setAudioOutput(outputstream); audio_buffer->open(QIODevice::ReadWrite); if(!audio_buffer->open(QIODevice::ReadWrite)) qDebug() << "Buffer not opened"; else { qDebug() << "Buffer size:" << audio_buffer->size(); audio_buffer->seek(0); myplayer->setSourceDevice(&audio_buffer, QUrl(file_name)); } } } }
Currently I am playing through QMultimedia but I want to do with QAudioOutput here. Please let me know everything I am doing wrong.
-
What is 'mplayer' and where do you actually call QAudioOutput::start()?
Please simplify your code or start with the example code and see if this works -
There is no need to study the code. My only question is whether QT has removed the start method from QAudioOutput class?
The example you linked in from QT5. Check QT6. https://doc.qt.io/qt-6/qaudiooutput-members.html -
You're right. The forum search function found this: https://forum.qt.io/topic/130480/porting-qaudiodevice-to-qt6-2