PDA

View Full Version : 'QSound': No such file or directory



smemamian
3rd July 2013, 09:43
hi

when i use :


#include <QSound>

i get this error message :


'QSound': No such file or directory

i added this text to my.pro :



greaterThan(QT_MAJOR_VERSION, 4): QT += widgets multimedia

rawfool
3rd July 2013, 11:39
After adding multimedia, did your run qmake again & rebuild ?

smemamian
3rd July 2013, 14:40
solved : I cleaned "build-Desktop_Qt_5_0_0_MSVC2010_32bit_SDK-Debug" and rebuilding my project .

But I hear no sound :(


void MainWindow::on_pushButton_clicked()
{
QSound sound(":/Music/exelent.wav");
sound.setLoops(1);
sound.play();
}

mnokka
8th April 2015, 10:28
I got my program (Qt 5.1 based) to compile with this trick.
However during runtime I got; QSoundEffect(qaudio): Error decoding source (audio file is played ok in windows player)

yeye_olive
8th April 2015, 11:10
Your code destroys the QSound instance immediately after scheduling the sound for playing. You should either extend the scope of the QSound or use the static QSound::play() method.

mnokka
8th April 2015, 11:53
I got my program (Qt 5.1 based) to compile with this trick.
However during runtime I got; QSoundEffect(qaudio): Error decoding source (audio file is played ok in windows player)


Found solution for the runtime issue; By using QMediaPlayer (Qt5.1 , WIN7 x64) I was able to play .wma and .mp3 files ok