PDA

View Full Version : phonon in qt


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?

mmurfin87
01-30-2010, 02:33 AM
First of all how did you get phonon working on the n900 in the first place? Everytime I try to run an app that uses phonon it tells me there is no shared library.

hopbeat
01-30-2010, 03:02 AM
@mmurfin87, libqt4-mamem5-phonon or libqt4-phonon installed? Also, in the pro file there is QT += phonon to be added.