Discussion Board

Results 1 to 8 of 8
  1. #1
    Regular Contributor erespia2's Avatar
    Join Date
    Nov 2010
    Posts
    51
    I'm doing an app. When I run a sound start with QSound, and
    Press exit buttom, I want to sound another sound before stopping.
    The startup sound is heard, but the sound by pressing the exit, not
    heard.

    Anyone can help me?

    I think it's because the sound is running in parallel, and the application ends before running, or something like that.

    The code is the same for the two cases, including tests with the same
    sound.

    CODE:

    QString son = "E:/Vaipho/Sonidos/apagando.wav";
    QSound *sonido = new QSound(son);
    sonido->play();

  2. #2
    Regular Contributor AlterX's Avatar
    Join Date
    Mar 2009
    Location
    Italy
    Posts
    153
    With a little interval using QTimer you can start the end of the app
    Merry Christmas Tombola! available on OVI Store!
    SuperDaddy available on OVI Store!

    QT VirtualKeyboard: http://qt-apps.org/content/show.php/VirtualKeyboard?content=107388
    Crack Generator: http://qt-apps.org/content/show.php/MosaicCrack?content=121832

  3. #3
    Regular Contributor erespia2's Avatar
    Join Date
    Nov 2010
    Posts
    51
    Quote Originally Posted by AlterX View Post
    With a little interval using QTimer you can start the end of the app
    Hi, Sorry, i don't understand

    I can explain more detailed?

    Thanks

  4. #4
    Regular Contributor AlterX's Avatar
    Join Date
    Mar 2009
    Location
    Italy
    Posts
    153
    Quote Originally Posted by erespia2 View Post
    Hi, Sorry, i don't understand
    I can explain more detailed?
    Thanks
    Create a slot (function) with a qApp->quit();

    void Clas::mySlotToExit()
    {
    qApp->quit();
    }

    then in your code:
    QSound:lay("mySoundBeforExit");
    QTimer::singleShot(timeOfTheSoundLen, this, SLOT(mySlotToExit));
    Merry Christmas Tombola! available on OVI Store!
    SuperDaddy available on OVI Store!

    QT VirtualKeyboard: http://qt-apps.org/content/show.php/VirtualKeyboard?content=107388
    Crack Generator: http://qt-apps.org/content/show.php/MosaicCrack?content=121832

  5. #5
    Regular Contributor erespia2's Avatar
    Join Date
    Nov 2010
    Posts
    51
    Quote Originally Posted by AlterX View Post
    Create a slot (function) with a qApp->quit();

    void Clas::mySlotToExit()
    {
    qApp->quit();
    }

    then in your code:
    QSound:lay("mySoundBeforExit");
    QTimer::singleShot(timeOfTheSoundLen, this, SLOT(mySlotToExit));


    Thank you very much, I am very grateful

  6. #6
    Regular Contributor erespia2's Avatar
    Join Date
    Nov 2010
    Posts
    51
    Ok, I have another problem.

    I work when I run the code by pressing a button created by me.

    But what I want is to put the code in the destructor of my main class, so when you give the default EXIT creates the app (right click terminal) and run the destructor, the sound does not sound.

    Not if you can make, but, as I can do?

    Thanks

  7. #7
    Regular Contributor AlterX's Avatar
    Join Date
    Mar 2009
    Location
    Italy
    Posts
    153
    Quote Originally Posted by erespia2 View Post
    Ok, I have another problem.

    I work when I run the code by pressing a button created by me.

    But what I want is to put the code in the destructor of my main class, so when you give the default EXIT creates the app (right click terminal) and run the destructor, the sound does not sound.

    Not if you can make, but, as I can do?

    Thanks
    If you want to do so, use your own exit button instead of the default one and create the path i said in the previous post
    Merry Christmas Tombola! available on OVI Store!
    SuperDaddy available on OVI Store!

    QT VirtualKeyboard: http://qt-apps.org/content/show.php/VirtualKeyboard?content=107388
    Crack Generator: http://qt-apps.org/content/show.php/MosaicCrack?content=121832

  8. #8
    Regular Contributor erespia2's Avatar
    Join Date
    Nov 2010
    Posts
    51
    Quote Originally Posted by AlterX View Post
    If you want to do so, use your own exit button instead of the default one and create the path i said in the previous post
    Ok.

    Thanks.

Similar Threads

  1. QSound Usage
    By atonical in forum Nokia N9
    Replies: 3
    Last Post: 2010-04-12, 07:17

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved