Results 1 to 3 of 3

Thread: QSound can not play immediately

  1. #1
    Join Date
    Feb 2011
    Posts
    6
    Qt products
    Qt/Embedded

    Default QSound can not play immediately

    Hi,
    When i play sound with Sleep function.But it can not play immediately.
    I play 2 wav files,but it plays at the same time
    Here is my code
    Qt Code:
    1. sound1 = new QSound("head.wav");
    2. sound2 = new QSound("donkey.wav");
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. sound1->play();
    2. Sleeper::sleep(15);
    3. sound2->play();
    To copy to clipboard, switch view to plain text mode 

    How can i play 2 wav files with Delay between them?
    Thanks and best regard!

  2. #2
    Join Date
    Feb 2011
    Posts
    6
    Qt products
    Qt/Embedded

    Default Re: QSound can not play immediately

    When i add the MessageBox between.It seems running ok.
    Anybody knows how to fix this problem

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QSound can not play immediately

    Quote Originally Posted by thanhluanbk88 View Post
    How can i play 2 wav files with Delay between them?
    You play the second sound after the first is finished and not two at once. If your first sound takes 15 seconds to play then run a 15s timer and when it timeouts, play the other sound. Or use some more advanced mechanism than QSound.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. [Tab play list]Load play lists on start
    By petrusPL in forum Qt Programming
    Replies: 0
    Last Post: 18th March 2011, 18:12
  2. Replies: 0
    Last Post: 2nd March 2011, 08:36
  3. QSound Play error
    By augusbas in forum Qt Programming
    Replies: 0
    Last Post: 1st February 2010, 05:57
  4. QSound don't play wav in qtopia 1.5.4, 1.7.0 and 2.2.0
    By alexandr in forum Qt for Embedded and Mobile
    Replies: 6
    Last Post: 30th January 2007, 19:05
  5. Replies: 1
    Last Post: 7th July 2006, 10:14

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.