第十四节cocosdx的声音接口

SimpleAudioEngine::sharedEngine()->preloadBackgroundMusic("1.mp3");
SimpleAudioEngine::sharedEngine()->playBackgroundMusic("1.mp3");
SimpleAudioEngine::sharedEngine()->stopBackgroundMusic();
SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
// 播放sound 的接口
playEffect();
stopEffect();//停止音效,可以选择单独停掉一个音效,通过创建时的m_nSoundId 停止
stopAllEffects();//停止全部音效
pauseEffect(m_nSoundId);//暂停单个音效
resumeEffect(m_nSoundId);//重新开始音效
pauseAllEffects();//暂停全部音效
resumeAllEffects();//重新开始全部音效
setEffectsVolume(0.5);//设置音效音量
unloadEffect(std::string(CCFileUtils::fullPathFromRelativePath(EFFECT_FILE)).c_str());//卸载音效
使用结束需要SimpleAudioEngine::sharedEngine()->end();

你可能感兴趣的:(android,cocos2dx,实例剖析)