#include <QSound>
QSound 只能播放WAVE格式的
一、播放功能:兩種方法
1)Public Slots
void play () // public slot inherited from QObject
實現方法(對象實例化):
QSound *sound=new QSound(音頻路徑及音頻文件); // (參照:void QSound::play () [slot])
this->sound->play();
2)Static Public Members
void play ( const QString & filename ) // static public members inherited from QObject
實現方法:
QSound::play(音頻路徑及音頻文件); (參照:void QSound::play ( const QString & filename ) [static])
或者
QSound sound(音頻路徑及音頻文件);
sound.play();
二、停止功能:
Public Slots
void stop () // public slot inherited from QObject
實現方法(對象實例化):
//QSound *sound=new QSound(音頻路徑及音頻文件); (參照:void QSound::stop () [slot])
//this->sound->play();
this->sound->stop();
如有不對請指教!