开发者

how to play a wav file in qt [duplicate]

开发者 https://www.devze.com 2023-02-17 20:12 出处:网络
This question already has answers here: Closed 10 years ago. Possible Duplicate: How to play sound with Qt开发者_运维技巧
This question already has answers here: Closed 10 years ago.

Possible Duplicate:

How to play sound with Qt 开发者_运维技巧

can anyone tell me how to play a .wav file in qt


I had some problems with qsound (it didn't work on my machine) so I needed to switch to Phonon. It's easy to use:

Phonon::MediaObject* _music;
_music = Phonon::createPlayer(Phonon::MusicCategory, Phonon::MediaSource(filename));
_music->play();

or better have a look into the doc


use QSound class to play a wave file. If you need to play more formats take a look at phonon

0

精彩评论

暂无评论...
验证码 换一张
取 消