cocos2d-x i9100 音效过多闪退问题不完美解决方案
2014-06-14 14:09
726 查看
cocos2dx/cocos2d-x-2.1.5/CocosDenshion/android/opensl/SimpleAudioEngineOpenSL.cpp
unsigned int SimpleAudioEngineOpenSL::playEffect(const char* pszFilePath, bool bLoop)
{
unsigned int soundID = s_pOpenSL->preloadEffect(pszFilePath);
if (soundID != FILE_NOT_FOUND)
{
if (s_pOpenSL->getEffectState(soundID) == PLAYSTATE_PLAYING)
{
s_pOpenSL->setEffectState(soundID, PLAYSTATE_STOPPED);
s_pOpenSL->setEffectState(soundID, PLAYSTATE_PLAYING);
s_pOpenSL->setEffectLooping(soundID, bLoop);
}
else
{
s_pOpenSL->setEffectState(soundID, PLAYSTATE_STOPPED);
s_pOpenSL->setEffectState(soundID, PLAYSTATE_PLAYING);
s_pOpenSL->setEffectLooping(soundID, bLoop);
}
}
return soundID;
}
就是在播放音效时不创建新的音效,而是停止之前的音效再重新播放,播出来会比较怪,但不闪退了
unsigned int SimpleAudioEngineOpenSL::playEffect(const char* pszFilePath, bool bLoop)
{
unsigned int soundID = s_pOpenSL->preloadEffect(pszFilePath);
if (soundID != FILE_NOT_FOUND)
{
if (s_pOpenSL->getEffectState(soundID) == PLAYSTATE_PLAYING)
{
s_pOpenSL->setEffectState(soundID, PLAYSTATE_STOPPED);
s_pOpenSL->setEffectState(soundID, PLAYSTATE_PLAYING);
s_pOpenSL->setEffectLooping(soundID, bLoop);
}
else
{
s_pOpenSL->setEffectState(soundID, PLAYSTATE_STOPPED);
s_pOpenSL->setEffectState(soundID, PLAYSTATE_PLAYING);
s_pOpenSL->setEffectLooping(soundID, bLoop);
}
}
return soundID;
}
就是在播放音效时不创建新的音效,而是停止之前的音效再重新播放,播出来会比较怪,但不闪退了
相关文章推荐
- cocos2d-x i9100 音效过多闪退问题不完美解决方案
- 关于cocos2d-x在xcode中安装完不显示模板问题的完美解决方案!
- xcode 下安装 cocos2d-x ,模板不显示问题完美解决方案
- 为FC3安装vmware tools问题的完美解决方案--come from vmware.cn' jorin
- Java Serialization UID 问题的完美解决方案
- Mysql中文乱码问题完美解决方案
- XCode4编译与发布cocos2d工程,到最后出现这个问题的解决方案
- JBuilder中文问题完美解决方案(转)
- Mysql中文乱码问题完美解决方案
- XCode4编译与发布cocos2d工程,到最后出现这个问题的解决方案
- Java环境下Imagemagick中文图片处理问题非完美解决方案
- asp.net ajax updatepanel 乱码问题 最完美解决方案
- DLL导出类避免地狱问题的完美解决方案
- asp.net ajax updatepanel 乱码问题 最完美解决方案
- Java环境下Imagemagick中文图片处理问题非完美解决方案
- 验证码缓存问题完美解决方案
- win2003系统下稻香老农上传问题完美解决方案
- Java环境下Imagemagick中文图片处理问题非完美解决方案
- python中的汉语乱码问题完美解决方案
- Mysql 中文乱码 问题 完美 解决方案 详解!