QSoundEffect(qaudio): Error decoding source

Are you sure your path is correct? If Qt can’t find the file it gives the “error decoding source” message which is misleading.

Add files to your resource file:

  • (If you haven’t already created one go to File | New | Qt | Qt Resource File).
  • Click Add existing files then select sound files you want
  • Right click and copy path
  • Paste path to play filename. e.g. QSound::play(“:/lose.wav”);

确定音频文件的路径正确?如果QT未找到文件,它给出错误信息“error decoding source”而产生误导。

将文件添加到resource文件:

  1. 如果没这个文件,文件|新建|Qt|Qt资源文件
  2. 点击 添加已存在文件,选择要播放的文件
  3. 右键点击并拷贝路径
  4. 粘贴路径给要播放的文件名,如: QSound::play(“:/lose.wav”);
注意 Resource URL

留下评论

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理