Cocos2d 背景音不播放第二次 C++/Win10 UWP

Cocos2d background sound not playing a second time C++/Win10 UWP

我在 windows10 上使用 cocoss2d 和 c++,我正在尝试播放背景音乐。它在我第一次调试游戏时有效,但在我第二次点击 运行 时它抛出了这些异常

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);

我不确定发生了什么事,有人可以与我分享一盏灯吗?

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

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

知道了!这不是很好的修复,但仍然。

文件:CCWinRTUtils.cpp 方法:createMappedCacheFile

一直在评论if/else建设和呼叫FileUtils::getInstance()->removeFile(prevFile)

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

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