hello all
I have a question how I can play music in slot with timer
I test in main programming and music nice play ,but I can not test loop with Qtimer ,
this is my code ,plz help
main:
ui->setupUi(this);
mediaObject = new Phonon::MediaObject(this);
audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
mediaObject->setCurrentSource(Phonon::MediaSource("/home/beep.wav"));
Phonon::createPath(mediaObject, audioOutput);
mediaObject->play(); //play
connect(m_timer,SIGNAL(timeout()),this,SLOT(play_music()));
m_timer->start(1000);
ui->setupUi(this);
mediaObject = new Phonon::MediaObject(this);
audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
mediaObject->setCurrentSource(Phonon::MediaSource("/home/beep.wav"));
Phonon::createPath(mediaObject, audioOutput);
mediaObject->play(); //play
m_timer =new QTimer(this);
connect(m_timer,SIGNAL(timeout()),this,SLOT(play_music()));
m_timer->start(1000);
To copy to clipboard, switch view to plain text mode
void MainWindow::play_music()
{
mediaObject->setCurrentSource(Phonon::MediaSource("/home/beep.wav"));
mediaObject->play();
}
void MainWindow::play_music()
{
mediaObject->setCurrentSource(Phonon::MediaSource("/home/beep.wav"));
mediaObject->play();
}
To copy to clipboard, switch view to plain text mode
Bookmarks