播放音乐

播放音乐


CocosDenshion::SimpleAudioEngine::sharedEngine()->stopBackgroundMusic();//停止背景音乐,可以代一个布尔型参数,表示是否释放音乐文件

CocosDenshion::SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();//暂停背景音乐  

CocosDenshion::SimpleAudioEngine::sharedEngine()->rewindBackgroundMusic();//重头调用背景音乐 

CocosDenshion::SimpleAudioEngine::sharedEngine()->isBackgroundMusicPlaying()//返回布尔型参数,是否在放着背景音乐 

CocosDenshion::SimpleAudioEngine::sharedEngine()->setBackgroundMusicVolume(0.5);//设置音量0.0-1.0
播放音效



CocosDenshion::SimpleAudioEngine::sharedEngine()->preloadEffect( );
CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect();
CocosDenshion::SimpleAudioEngine::sharedEngine()->stopEffect();//停止音效,可以选择单独停掉一个音效,通过创建时的m_nSoundId停止

CocosDenshion::SimpleAudioEngine::sharedEngine()->stopAllEffects();//停止全部音效

CocosDenshion::SimpleAudioEngine::sharedEngine()->pauseEffect(m_nSoundId);//暂停单个音效

CocosDenshion::SimpleAudioEngine::sharedEngine()->resumeEffect(m_nSoundId);//重新开始音效

CocosDenshion::SimpleAudioEngine::sharedEngine()->pauseAllEffects();//暂停全部音效

CocosDenshion::SimpleAudioEngine::sharedEngine()->resumeAllEffects();//重新开始全部音效

CocosDenshion::SimpleAudioEngine::sharedEngine()->setEffectsVolume(0.5);//设置音效音量

CocosDenshion::SimpleAudioEngine::sharedEngine()->unloadEffect(std::string(CCFileUtils::fullPathFromRelativePath(EFFECT_FILE)).c_str());//卸载音效



你可能感兴趣的:(播放音乐)