【问题标题】:Cocos2d background sound not playing a second time C++/Win10 UWPCocos2d背景音没有第二次播放C++/Win10 UWP
【发布时间】:2015-11-18 22:18:29
【问题描述】:

我在 Windows 10 上使用带有 c++ 的 cocoss2d,我正在尝试播放背景音乐。它在我第一次调试游戏时有效,但在我第二次运行时它会抛出这些异常

Exception thrown at 0x765F3E28 (KernelBase.dll) in MiniGolf.exe: 0x000006BA: The RPC server is unavailable.
Exception thrown at 0x765F3E28 (KernelBase.dll) in MiniGolf.exe: 0x0000000E: Not enough storage is available to complete this operation.
Assert failed: getFileSize should be override by platform FileUtils
Assertion failed!

我只是用这条线开始音乐。

CocosDenshion::SimpleAudioEngine::getInstance()->playBackgroundMusic("level_music1.wav",true);

我不知道发生了什么事可以和我分享一下吗?

【问题讨论】:

    标签: c++11 cocos2d-x windows-10


    【解决方案1】:

    cocos2d-x 3.9 CCWinRTUtils.cpp 添加第 336 行

    if (ret[0] == '/') {
        ret = ret.substr(1, ret.length() - 1);
    }
    

    【讨论】:

    • 将此行添加到CCWinRTUtils.cpp后是否需要重新构建项目?
    【解决方案2】:

    知道了!这不是很好的解决方法,但仍然如此。

    文件:CCWinRTUtils.cpp 方法:createMappedCacheFile

    我已经评论了 if/else 构造并一直致电FileUtils::getInstance()->removeFile(prevFile)

    现在它在 Windows10 和 Windows Phone 8.1 上都能正常工作。

    据我所知,缓存仅适用于当前会话。之前的解决方案(通过标签缓存)用于缓存从 Internet 加载的声音,而不是本地文件所需要的。

    【讨论】:

      猜你喜欢
      • 2012-08-22
      • 1970-01-01
      • 2011-09-24
      • 1970-01-01
      • 1970-01-01
      • 2011-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多