×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Regular Contributor
    Join Date
    Nov 2010
    Posts
    51

    QSound problem, help

    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
    Registered User
    Join Date
    Mar 2009
    Location
    Italy
    Posts
    153

    Re: QSound problem, help

    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
    Join Date
    Nov 2010
    Posts
    51

    Re: QSound problem, help

    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
    Registered User
    Join Date
    Mar 2009
    Location
    Italy
    Posts
    153

    Re: QSound problem, help

    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
    Join Date
    Nov 2010
    Posts
    51

    Re: QSound problem, help

    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
    Join Date
    Nov 2010
    Posts
    51

    Re: QSound problem, help

    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
    Registered User
    Join Date
    Mar 2009
    Location
    Italy
    Posts
    153

    Re: QSound problem, help

    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
    Join Date
    Nov 2010
    Posts
    51

    Re: QSound problem, help

    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
  •  
×