PDA

View Full Version : cant make QSound work



akon
17th March 2009, 15:23
i cant make a sound using QSound.
ubuntu 8.04
QT X11
Wave file is 16 bit non-compressed .


#include <QApplication>
#include <QSound>


int main(int argc, char *argv[])
{
QApplication a(argc, argv);

QSound:: play("../wavefile/laugh.wav");

/* QString alarmInfo;
if (argc > 1) {
alarmInfo = argv[1];
}
else {
alarmInfo = "..........................." ;
}
*/

return a.exec();
}

JimDaniel
17th March 2009, 19:01
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.

Lykurg
17th March 2009, 20:43
...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.

akon
18th March 2009, 08:19
thank you guys,
its really strange:confused: . 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.....

wysota
18th March 2009, 09:05
Do you have the nas server running?

akon
18th March 2009, 09:49
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.

wysota
18th March 2009, 11:40
Use Phonon.

akon
19th March 2009, 14:37
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 :crying:
I really thankful to u guys. Is there any other way that i can try.

thanks

wysota
19th March 2009, 15:34
You can install nas :) Or you can use an external player.