cocos2d-x 常用音訊介面
阿新 • • 發佈:2018-11-02
//預載入 const char* fileName = "xxx.mp3"; #define audioEngine = SimpleAudioEngine::getInstance() //預載入背景音樂 audioEngine->preloadBackgroundMusic(fileName); //預載入音效 audioEngine->preloadEffect(fileName); //設定 //設定背景音量大小 audioEngine->setBackgroundMusicVolume(float); //設定音效音量 audioEngine->setEffectVolume(float); //播放暫停 //播放背景音樂 audioEngine->playBackgroundMusic(fileName); //播放音效 audioEngine->playEffect(fileName); //暫停背景音樂 audioEngine->pauseBackgroundMuisc(); //暫停音效 audioEngine->pauseAllEffect(); //恢復背景音樂 audioEngine->resumeBackgroundMusic(); //恢復音效 audioEngine->resumeAllEffects(); //停止背景音樂 audioEngine->stopBackgroundMuisc(); //停止音效 audioEngine->stopAllEffects();