Results 1 to 9 of 9

Thread: cant make QSound work

  1. #1
    Join Date
    Mar 2009
    Posts
    19
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default cant make QSound work

    i cant make a sound using QSound.
    ubuntu 8.04
    QT X11
    Wave file is 16 bit non-compressed .

    Qt Code:
    1. #include <QApplication>
    2. #include <QSound>
    3.  
    4.  
    5. int main(int argc, char *argv[])
    6. {
    7. QApplication a(argc, argv);
    8.  
    9. QSound:: play("../wavefile/laugh.wav");
    10.  
    11. /* QString alarmInfo;
    12.   if (argc > 1) {
    13.   alarmInfo = argv[1];
    14.   }
    15.   else {
    16.   alarmInfo = "..........................." ;
    17.   }
    18. */
    19.  
    20. return a.exec();
    21. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 18th March 2009 at 10:05. Reason: missing [code] tags

  2. #2
    Join Date
    Sep 2007
    Location
    Rome, GA
    Posts
    199
    Thanks
    14
    Thanked 41 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: cant make QSound work

    I'm not familiar with X11, but the first thing I would do is pass in an absolute path to the sound file, to narrow down the possibility that it's just not finding the file. There was a poster here last week who had the same trouble, and it ended up being the wrong path to the sound.

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: cant make QSound work

    ...and have you checked QSound::isAvailable() and I don't know what sounds do you want to play but maybe you could have a look at Phonon for a "professional" sound playing solution.

  4. #4
    Join Date
    Mar 2009
    Posts
    19
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: cant make QSound work

    thank you guys,
    its really strange . same code is giving output to another machine. and wonder of all wonders both machine has same config ...
    may be refreshing QT and OS should be a wise one.....

  5. #5
    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: cant make QSound work

    Do you have the nas server running?
    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.


  6. #6
    Join Date
    Mar 2009
    Posts
    19
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: cant make QSound work

    hey wysota,
    YES, U RIGHT . NAS is not running in my machine.... and not sure about NAS support on device.
    so How can i play sound file with qt4, without NAS support.

  7. #7
    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: cant make QSound work

    Use Phonon.
    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.


  8. #8
    Join Date
    Mar 2009
    Posts
    19
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: cant make QSound work

    thanks, I checked phonon and its working fine....As Phonon is a big library so, only for this alarm sound I will not get Phonon library support. its a head spinning
    I really thankful to u guys. Is there any other way that i can try.

    thanks

  9. #9
    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: cant make QSound work

    You can install nas Or you can use an external player.
    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. QThread doent work for QSound
    By anafor2004 in forum Qt Programming
    Replies: 2
    Last Post: 19th November 2008, 17:00
  2. how to make Window+M key work for my application
    By yxmaomao in forum Qt Programming
    Replies: 4
    Last Post: 10th July 2008, 01:35
  3. make QTableView work as a multi-column list view
    By wesley in forum Qt Programming
    Replies: 1
    Last Post: 11th March 2008, 15:43
  4. how to make QHttp work with this URL
    By ber_44 in forum Qt Programming
    Replies: 11
    Last Post: 23rd April 2007, 10:20
  5. Why can't I make dynamic_cast work properly?
    By pir in forum General Programming
    Replies: 13
    Last Post: 18th July 2006, 17:17

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.