Unsolved Hi, I would like to add a sound when i push a button, i have this code but it doesn't actually work, the error while compiling: QSoundEffect(qaudio): Error decoding source, How do i fix this please?
-
QSoundEffect effect; effect.setSource(QUrl::fromLocalFile("1.mp3")); effect.setLoopCount(QSoundEffect::Infinite); effect.setVolume(50); effect.play();
-
I think it's telling you that you cannot (and I'll add should-not) attempt to use mp3 for the purpose you describe. Try loading a raw PCM file like WAV format instead.
-
i tried to use a wav file but it generates the same error(QSoundEffect(qaudio): Error decoding source)
-
Where do you put this wav file? Try to use the full path.
-
Hi and welcome to devnet,
You are using a relative path so your application will not find the file as it is not located in the same folder.
On an unrelated not, please give your thread a meaningful title and put the actual text of your enquiry as the body of the post along with your code.