多一分钟学习,早一秒钟提高

VC++、C++、Socket、DirectUI、wxWidgets、Cocos2d-x、CocosCreator、Unity3D、UE4、ThinkPHP
posts - 32, comments - 12, trackbacks - 0, articles - 0
  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

SimpleAudioEngine 判断音效是否播放完

Posted on 2014-05-18 15:21 虚空骄阳 阅读(664) 评论(0)  编辑 收藏 引用 所属分类: Cocos2d-x
SimpleAudioEngine.h 文件中添加以下函数定义:
//判断当前音效是否已经播放完
bool getEffectIsPlayingFinished(unsigned int nSoundId);

SimpleAudioEngine.cpp 函数实现,比较简单:
//判断当前音效是否已经播放完
bool SimpleAudioEngine::getEffectIsPlayingFinished(unsigned int nSoundId)
{
       EffectList::iterator itor = sharedList().find(nSoundId);
       bool bRet = false;
       if ( itor != sharedList().end() )
       {
              bRet = itor->second->IsPlaying();
       }
       return bRet;
}

注:修改后将libCocosDenshion类库重新编译一下。只要通过我们的soundid参数,便可找到MciPlayer,然后就可以处理了。

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理