[Qt-interest] Using Phonon

Harri Pasanen grego at mpaja.com
Wed Nov 17 11:13:55 CET 2010


Hi,

I'm having some trouble getting Phonon to behave, not sure if I should blame 
myself, linux sound stack, or Phonon.  My current conclusion is that Phonon is 
in need of some love.

I'm on Kubuntu 10.04 amd64, using Qt in PATH, also tried with 4.7.0.
I replicated the test on s60 5th edition with similar results.

I try to play 2 sounds consecutively. 

I thought I could do this by calling

_mediaObject->enqueue(sounds);
_mediaObject->play();

sounds is a 
const QList<Phonon::MediaSource> &sounds
with 2 items.

And indeed it works the first time.  But second time through I only hear the 
sound once (I have the same sound, so don't know if it is first or last)

If I print out the mediaObject->state()  before the above two calls, it is at 
Phonon::LoadingState the very first time, then it will be at 
Phonon::StoppedState (on S60 it was at Phonon::PausedState)

I would have thought that play() would consume the queue, but somehow it just 
keeps looping on it?  

I was able to force it working with the following contraption:

  if (_mediaObject->state() == Phonon::LoadingState) {
    _mediaObject->setCurrentSource(sounds.at(0));
    for (int i = 1; i < sounds.length(); ++i)
      _mediaObject->enqueue(sounds.at(i));
  }
  else {
    _mediaObject->setQueue(sounds);
    _mediaObject->setCurrentSource(sounds.at(0));
  }
  _mediaObject->play();

But I arrived to this through trial and error, not through the docs (which I 
have read).  Not to mention it doesn't look very clean.

I wonder if I a QTBUG with test case would help, are these issues known?



-- 
Grego
http://mpaja.com/



More information about the Qt-interest-old mailing list