Results 1 to 3 of 3

Thread: Delay using sound at Qt

  1. #1
    Join Date
    Nov 2010
    Posts
    23
    Thanks
    10
    Qt products
    Qt/Embedded
    Platforms
    MacOS X Windows

    Default Delay using sound at Qt

    Guys,
    I'm having a lot of button producing sound in my widget, but there are some kind of delay from the time i touch the button on the device until the sound came. I'm using phonon to play the sound and the sound format are .aac or .wav.

    Is it because the sound format? the phonon? or something else? I really need to get a quick response from the program to play the sound.

    Thank you very much

  2. #2
    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: Delay using sound at Qt

    It's because of all that together. If you initialize Phonon's facilities at the time you want to play sound then it takes time because it has to load things into memory. It's better to prepare everything earlier and only start playing when a button is clicked.
    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.


  3. The following user says thank you to wysota for this useful post:

    ardisaz (15th December 2010)

  4. #3
    Join Date
    Nov 2010
    Posts
    23
    Thanks
    10
    Qt products
    Qt/Embedded
    Platforms
    MacOS X Windows

    Default Re: Delay using sound at Qt

    i have like 6 different instrument with different note to be played. Should i initiate the phonon at the main menu before we chose the instrument? But there will be about 30-40 mediaobject created and only 6-10 used at one time.

    In my program, before we go to one instrument, i initialize phonon and each time i push the sound button to play a note, i only use play. But it still has the delay problem. Here an example of my project

    Qt Code:
    1. void drumplayer::phonon_initiation(){
    2. snare = Phonon::createPlayer(Phonon::MusicCategory, Phonon::MediaSource("snare.wav"));
    3.  
    4. bass = Phonon::createPlayer(Phonon::MusicCategory, Phonon::MediaSource("bass.wav"));
    5. }
    6.  
    7. void drumplayer::playsnare(){
    8. snare->stop();
    9. snare->play();
    10. }
    11.  
    12. void drumplayer::playbass(){
    13. bass->stop();
    14. bass->play();
    15. }
    To copy to clipboard, switch view to plain text mode 

    thanks for your help

Similar Threads

  1. How to add timer delay
    By qtUse in forum Newbie
    Replies: 1
    Last Post: 12th October 2010, 19:09
  2. Delay initializing?
    By MorrisLiang in forum Newbie
    Replies: 4
    Last Post: 23rd August 2010, 16:37
  3. How to delay a Signal?
    By trusch in forum Qt Programming
    Replies: 6
    Last Post: 26th June 2009, 07:18
  4. Timer delay
    By bmn in forum Qt Programming
    Replies: 11
    Last Post: 3rd June 2008, 12:54
  5. MP3 Sound / OGG Sound Play on GUI
    By patrik08 in forum Newbie
    Replies: 3
    Last Post: 1st September 2006, 20:01

Tags for this Thread

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.