Results 1 to 2 of 2

Thread: phonon queue problem

  1. #1
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default phonon queue problem

    Hi,

    I have trouble to clear the queue of a Phonon::MediaObject definitely. I have a "global":
    Qt Code:
    1. Phonon::MediaObject *phononSound;
    2. phononSound = Phonon::createPlayer(Phonon::MusicCategory);
    To copy to clipboard, switch view to plain text mode 
    and a function which can be triggered by the user.
    Qt Code:
    1. phononSound->clearQueue();
    2. QList<Phonon::MediaSource> soundfiles;
    3. // here soundfiles are filed with 0 to 3 wav files.
    4. if (!soundfiles.isEmpty())
    5. {
    6. phononSound->setCurrentSource(soundfiles.takeFirst());
    7. phononSound->enqueue(soundfiles);
    8. phononSound->play();
    9. }
    10. else
    11. phononSound->stop();
    To copy to clipboard, switch view to plain text mode 

    Now following output occurs:
    function called 1st: 2 wav files
    -> played 1st wav of 1st call
    function called again: 1 wav file
    -> played (1st) wav of 2nd call (debug at the end of the 2nd call says that the queue is empty)
    -> played 2nd wav of the 1st function call. ???

    Why the queue isn't cleared correctly? What's wrong? Various placed phononSound->stop() on different places wont change anything.

    Thanks
    Lykurg

  2. #2
    Join Date
    Jul 2008
    Posts
    47
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: phonon queue problem

    You enqueued 2 files.
    They are played one after each other.

    For any call mediaObject->stop you should wait until the mediaObject receives the stateChanged signal with stoped state before assuming it will do something different.

    Phonon is asynchronous and state based.
    mediaObject->stop() returns imidiately, but at this point in time it is not yet stopped.

Similar Threads

  1. I cannot run the phonon demos in the PXA270!Can someone help me?
    By Justin_W in forum Qt for Embedded and Mobile
    Replies: 8
    Last Post: 19th February 2010, 10:14
  2. configuring Phonon problem
    By anafor2004 in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 7th February 2009, 21:02
  3. Weird problem: multithread QT app kills my linux
    By Ishark in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2008, 09:12
  4. Problem rendering QImage from Phonon Widget
    By JimDaniel in forum Qt Programming
    Replies: 2
    Last Post: 12th July 2008, 15:31
  5. Replies: 6
    Last Post: 21st September 2007, 13:51

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.