hopbeat
01-28-2010, 01:46 PM
I have problem with Phonon performance in my Qt project.
I'm using QGraphicsScene to render graphic elements.
In order to play sounds I use
Phonon::MediaObject* sound
I load the soundfile at the beginning and play it in random moments in the background.
sound =Phonon::createPlayer(Phonon::MusicCategory,Phonon ::MediaSource("sound.mp3"));
QWidget::connect(sound,SIGNAL(aboutToFinish()),sou nd,SLOT(pause()));
and then
sound->play();
sound->seek(1);
This gives slightly better performance than letting the file to and tha starting it (with play()) again.
I run it in different pthread, which increases the performance further.
Still however, when the sound plays there is a glitch in graphics. Also, is trying to play a long sound in the background constantly, the performance drops.
What is the right way to do this? How to achieve nice background playing without performance drop?
I'm using QGraphicsScene to render graphic elements.
In order to play sounds I use
Phonon::MediaObject* sound
I load the soundfile at the beginning and play it in random moments in the background.
sound =Phonon::createPlayer(Phonon::MusicCategory,Phonon ::MediaSource("sound.mp3"));
QWidget::connect(sound,SIGNAL(aboutToFinish()),sou nd,SLOT(pause()));
and then
sound->play();
sound->seek(1);
This gives slightly better performance than letting the file to and tha starting it (with play()) again.
I run it in different pthread, which increases the performance further.
Still however, when the sound plays there is a glitch in graphics. Also, is trying to play a long sound in the background constantly, the performance drops.
What is the right way to do this? How to achieve nice background playing without performance drop?