Results 1 to 3 of 3

Thread: QSound Unavailable

  1. #1
    Join Date
    Jan 2006
    Posts
    22
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QSound Unavailable

    Hi

    I'm trying to use sounds in my application... However, QSound::isAvailable returns a FALSE. QApplication::beep() doesn't work either.
    Why is this?? is there any way i can still play sounds?? I am working on a Mandrake 10 machine.

    Thanks
    superutsav
    Last edited by superutsav; 29th January 2006 at 05:03. Reason: Typo
    He who laughs last thinks slowest.

  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: QSound Unavailable

    You have to have Qt compiled with NAS support (and of course have all NAS dependencies installed).

  3. #3
    Join Date
    Jan 2006
    Location
    Skopje, Macedonia
    Posts
    11
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: QSound Unavailable

    If you don't want to install NAS and recompile QT with nas support you
    can use QProcess and start external app that will play the sound file

    Example (QT3.x):


    the cration of the process
    Qt Code:
    1. QProcess *AlarmProcess;
    2. AlarmProcess = new QProcess (this);
    3. AlarmProcess->setArguments("playwave"); // the player
    4. AlarmProcess->addArgument("alarm.wav"); // the file
    To copy to clipboard, switch view to plain text mode 

    playing
    Qt Code:
    1. AlarmProcess->start();
    To copy to clipboard, switch view to plain text mode 

    stopping
    Qt Code:
    1. AlarmProcess->tryTerminate(); // it actualy waits for the process to finish
    2. // then it terminates
    To copy to clipboard, switch view to plain text mode 

    you can also use:
    Qt Code:
    1. AlarmProcess->Terminate();
    To copy to clipboard, switch view to plain text mode 
    but it terminates the process immediately, and the memory used might not be cleaned completely.

    If you need to play the sound repeatedly you should connect the processExited() signal
    Qt Code:
    1. connect( AlarmProcess, SIGNAL(processExited()),
    2. this, SLOT(exitedSlot()) );
    To copy to clipboard, switch view to plain text mode 

    and to implement the signal hendler
    Qt Code:
    1. void FormMain::exitedSlot()
    2. {
    3. if (AlmSound) // flag - should the sound be played again
    4. AlarmProcess->start();
    5. }
    To copy to clipboard, switch view to plain text mode 

    Cheers, chombium

Similar Threads

  1. QSound and embedded resources
    By baray98 in forum Qt Programming
    Replies: 4
    Last Post: 19th May 2017, 13:38
  2. QThread doent work for QSound
    By anafor2004 in forum Qt Programming
    Replies: 2
    Last Post: 19th November 2008, 16:00
  3. QSound on Suse Linux
    By brent99 in forum Newbie
    Replies: 1
    Last Post: 11th March 2008, 08:41
  4. Is QSound all there is?
    By ad5xj in forum Newbie
    Replies: 4
    Last Post: 1st September 2007, 01:31
  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.