How to get QAudioBUffer from QMediaPlayer ?
-
Hi
initialize player
@ player =new QMediaPlayer(0, QMediaPlayer::StreamPlayback);
// QMediaContent track=QUrl("http://stream2.kissfm.ua:8000/kiss");
QMediaContent track=QUrl("http://pub2.sky.fm:80/sky_world");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 secondand my peak meter looks like it (on left)
!http://gyazo.com/a45cb3f5dd5a072094d41463ad0b56c3.gif(animation playing)!how to get mannualy QAudioBuffer from probe or mediaplayer or have any other way to get buffer?
sorry for my bad english :/
-
update post
-
update post now
-
Hi,
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.
-
help!!!!!!!!!!!!!!!!
-
Have you emailed the Interest mailing list?
-
i no use email
-
.................................upupuupuupupupupupupup
-
Hi,
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.
-
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
}void onTimerTimeout()
{
// 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);get_and_show_peak_value(audioData);
}
@