QSoundEffect(pulseaudio): Error decoding source
-
wrote on 19 May 2021, 17:09 last edited by
Hi. Why sound doesn't play?
I tried use mp3 from recources, but it didn't help. What am I doing wrong?
The click.mp3 located the same folder's level as MainWindow.QT += core gui QT += multimedia
void MainWindow::on_pushButton_clicked() { QSound::play("./click.mp3"); }
-
Hi. Why sound doesn't play?
I tried use mp3 from recources, but it didn't help. What am I doing wrong?
The click.mp3 located the same folder's level as MainWindow.QT += core gui QT += multimedia
void MainWindow::on_pushButton_clicked() { QSound::play("./click.mp3"); }
Hi
well you ask it to load it from the current folder which would be the build folder
once the app runs. ( not the project folder)
try to put it there.Also Im not sure QSound does support mp3 files. all samples i saw always use *.wav.
-
wrote on 19 May 2021, 17:58 last edited by Evgeny Siberia
@mrjj
I converted to wav, but it didn't help. -
Hi,
As @mrjj you should also copy the file in your build folder since you are using a relative path.
-
Hi,
As @mrjj you should also copy the file in your build folder since you are using a relative path.
wrote on 19 May 2021, 18:10 last edited by -
Your path is not a resource path.
-
wrote on 19 May 2021, 18:19 last edited by Evgeny Siberia
@SGaist
Shurely, I changed code. And I copied path (right click on the recource file in Qt -> copy path)QSound *s = new QSound(":/main/click.wav"); s->play();
Updated: all are working, my wrong, thank you.
1/7