1.文件包含:
#include "cocos2d.h"
#include "SimpleAudioEngine.h"
using namespace CocosDenshion;
2.直接使用即可:
//一:播放背景音乐
////1.预加载背景音乐
//SimpleAudioEngine::getInstance()->preloadBackgroundMusic("Sound/background.mp3");
////2.声音大小(0.0-1.0)手机上可用,Pc机不可用。
//SimpleAudioEngine::getInstance()->setBackgroundMusicVolume(0.5);
////3.设置循环播放
//SimpleAudioEngine::getInstance()->playBackgroundMusic("Sound/background.mp3",true);
////暂停
//SimpleAudioEngine::getInstance()->pauseBackgroundMusic();
////继续
//SimpleAudioEngine::getInstance()->resumeBackgroundMusic();
////停止
//SimpleAudioEngine::getInstance()->stopBackgroundMusic();
////二:播放音效
////1.预加载音效
//SimpleAudioEngine::getInstance()->preloadEffect("Sound/effect1.wav");
////2.播发音效
//SimpleAudioEngine::getInstance()->playEffect("Sound/effect1.wav");