Qt:如何重复声音x次与QtSound
Qt: How to repeat sound x times with QtSound
我不确定我是否正确理解QSound。setLoop函数应该可以工作。
我想播放一些波文件3次。我试过下面的代码,但它只播放一次。
QSound soundObj(filePath);
soundObj.setLoops(3);
soundObj.play();
帮助:-)
编辑:该代码的完整版本如下所示
void Alarms::playSound(QString filePath)
{
QSound soundObj(filePath);
soundObj.setLoops(3);
soundObj.play();
}
soundObj对象被快速销毁。
必须动态分配
相关文章:
- 输出 0 和 -0 的二次公式,与给定的项无关
- 如果包含映射的静态库与可执行文件和动态库链接,静态映射(变量)是否会被多次释放?
- 多次插入 (<<) 与串联输出 (+)
- 如何防止GUI挂起,同时允许第二次操作与Qt中的第一次操作一起执行
- 为什么一次包装 typedef 函数签名与原始签名不匹配
- 为什么与<运算符的向量比较会比较每个项目两次?
- 双三次插值结果与FFMPEG不同
- 析构函数在与 STL 的共享指针中调用两次
- #pragma 一次与包括警卫
- 在将数组与字符数组进行比较后需要帮助输出一次结果
- 派生类与多次调度中的过载方法
- 每帧需要一次时make_heap与priority_queue效率
- 尝试将矩阵与常数重载运算符相乘两次
- 第一次与 Void 合作
- 逐行写入文件与一次写入全文
- 将字符串数组与用户输入的单个字符串进行比较,它还表明它在该位置找到 2 次
- 我想一次将一个字符串与许多不同的正则表达式进行比较
- 我如何配置cmake编译一个文件两次与两个不同的编译器
- CreateWindowEx失败.我如何让我的窗口(与按钮)实际上一次弹出
- Qt:如何重复声音x次与QtSound