在Qt中播放WAV文件5.3 [英] Playing WAV Files in Qt 5.3

查看:713
本文介绍了在Qt中播放WAV文件5.3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从学校上课以来,我一直在Qt最近做一个闹钟。无论如何,我大约一年前使用旧版本的Qt,并使用Phonon的声音,但Phonon不再包括在Qt。我试过使用QtMultimedia,但它似乎不工作,因为我缺少库文件。如果你知道一种方法来播放音频文件在Qt,如果你告诉我如何,将非常感谢。

I've been trying to make an alarm clock lately in Qt since school is coming up. Anyhow, I made on about a year ago using an old version of Qt, and used Phonon for the sound, but Phonon is no longer included in Qt. I've tried using QtMultimedia, but it doesn't seem to work because I am missing the library file. If you know a way to play an audio file in Qt, it would be greatly appreciated if you tell me how.

推荐答案

QSound可以播放wav文件,QMultimedia对于这个简单的工作太重了。 QSound是短路报警信号的完美解决方案。最简单的方法是使用静态方法 play()

QSound can play wav files, QMultimedia is too heavy for this simple job. QSound is perfect solution for short alarm signals. The simplest way is to use static method play()

QSound::play("pathToFile");

这篇关于在Qt中播放WAV文件5.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆