Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to get QAudioBUffer from QMediaPlayer ?
player =new QMediaPlayer(0, QMediaPlayer::StreamPlayback); player->setVolume(20); player->setMedia(track); probe = new QAudioProbe; connect(probe, SIGNAL(audioBufferProbed(QAudioBuffer)), this, SLOT(processBuffer(QAudioBuffer))); // this send signal with QAudioBuffer argument
qbuffer me need for create peak meter
this method is bad , signal emited onсe per second
and my peak meter looks like it (on left)
how to get mannualy QAudioBuffer from probe or mediaplayer or have any other way to get buffer?
sorry for my bad english :/
update post now
I couldn't find any way to do that, sorry.
However, subscribe to the "Interest mailing list":http://lists.qt-project.org/mailman/listinfo/interest and ask there. You can find Qt engineers on that mailing list.
Yoann Lopes is the maintainer for Qt Multimedia. He will know for sure if you can get an QAudioBuffer in a different way, or if you can probe faster.
Have you emailed the Interest mailing list?
i no use email
Like JKSH suggested, use the interest mailing list, if you really don't want to there's still the IRC channel. You can also dig through Qt's code.
However low-level questions like this one are less likely to find an answer here since this forum is more user oriented and only very few Qt devs are on it.
ylopes last edited by
This is the only way to get audio buffers from a QMediaPlayer.
In your case, each QAudioBuffer you receive contains 1 second of audio, this why the signal is emitted only once per second.
You could have a timer with a smaller interval and then for each tick you would get the appropriate sample from the last received QAudioBuffer.
Something like this:
void processBuffer(const QAudioBuffer &buffer)
m_lastBuffer = buffer;
m_lastBufferTime.restart(); // This is a QTime instance
// This could be called every 100 ms for example
qint64 timeSinceLastBuffer = m_lastBufferTimer.elapsed() * 1000; // converted to microseconds
const void *audioData = m_lastBuffer.constData() + m_lastBuffer.format().bytesForDuration(timeSinceLastBuffer);