QMediaPlayer positionChanged(). Problem with slider updating
-
Hi everyone,
i try to use QMediaPlayer class to play simple wav-file (PCM 16sle). I have a form with buttons and horizontal slider. To update slider position i use connection of signal positionChanged() with slot of my form. Sounds fine, but everytime on positionChanged() signal receiving, sound of playing has file interrupted. I hear it perfectly, NotifyInterval is 250 ms, so 4 time per second - interrupt.
My code is same with other simple examples, it's like here:
@ //QMediaPlayer object creation
_player = new QMediaPlayer(this, QMediaPlayer::LowLatency);connect(_player, SIGNAL(positionChanged(qint64)), this, SLOT(on_PlayerPositionChanged(qint64)));
_player->setMedia(QUrl::fromLocalFile("S1.1.wav"));
_player->setNotifyInterval(250); //interval 250 ms
ui->slPlay->setMinimum(0);
ui->slPlay->setMaximum(static_cast<int> (_curWavFile->GetDurTime()) * 4);//This is SLOT
void SpectrogramWindow::on_PlayerPositionChanged(qint64 val)
{
ui->slPlay->setSliderPosition(static_cast<int> (val / 250));
}
@Please, could somebody help me?