QSound::play(“soundpath”) call works but a QSound object doesn't

痴心易碎 提交于 2019-12-20 03:20:14

问题


I am trying to play a sound with QSound module.

It try with this code and works:

QSound::play(":/sounds/sources/BeepSound.wav");

But I want this and doesn't work:

I create a dynamic instance of QSound and played:

sounds = new QSound(":/sounds/sources/BeepSound.wav");
sounds->setLoops(3);
sounds->play();

Any tips?

Update

I don't want to use others modules like QMediaPlayer, QAudioOutput because I want something really simple, just play a sound.

来源:https://stackoverflow.com/questions/30812327/qsoundplaysoundpath-call-works-but-a-qsound-object-doesnt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!