PDA

View Full Version : How to implement QSound setLoop() method in Phonon Mediaobject?



kishoreksnair
18th October 2011, 05:32
We created an application using Phonon MediaObject.In this application we want
to play a song continuously without any delay.After surfing from various web resources :we use Qsound method.Its completely rectified the looping problem just we use setLoop(-1).But we could't find several phonon functionality in QSound such as:Volumeslider,pause,seekslidebar etc.




QString extmusicpath="sound/sample.wav";
Phonon::SeekSlider *extSeekSlider;
Phonon::MediaObject *extMediaObject;
Phonon::MediaObject *extMetaInformationResolver;
Phonon::AudioOutput *extAudioOutput;
Phonon::VolumeSlider *extVolumeSlider;


extAudioOutput= new Phonon::AudioOutput(Phonon::VideoCategory, this);
extVolumeSlider = new Phonon::VolumeSlider(ui->externalDirFrame);
extVolumeSlider->setObjectName(QString::fromUtf8("volumeSlider"));
extVolumeSlider->setStyleSheet("border:none;background:none;");
extVolumeSlider->setGeometry(QRect(100,40,150,50));
extMediaObject= new Phonon::MediaObject(this);
extMediaObject->setCurrentSource(Phonon::MediaSource(extmusicpath) );
extMediaObject->setPrefinishMark(300);
extMediaObject->setTransitionTime(0);
connect(extMediaObject,SIGNAL(prefinishMarkReached (qint32)), SLOT(extnextSource(qint32)));
Phonon::createPath(extMediaObject,extAudioOutput);
extVolumeSlider->setAudioOutput(extAudioOutput);

void MainWindow::extnextSource(qint32)
{
extMediaObject->seek(0);
}



After using the above methods,there is less than one second delay while looping

How can we rectify this problem?