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

0

I'm using cocoss2d with c++ on windows 10 and I'm trying to play background music. It works the first time I debug the game but on the second time I hit run it throws these exceptions

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!

I simply use this line to start the music.

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

I'm not sure what's going on can anyone share a light with me ?

c++11
cocos2d-x
windows-10
asked on Stack Overflow Nov 18, 2015 by yossi elimelech

2 Answers

1

cocos2d-x 3.9 CCWinRTUtils.cpp line 336 added

if (ret[0] == '/') {
    ret = ret.substr(1, ret.length() - 1);
}
answered on Stack Overflow Dec 17, 2015 by naosoft
1

Got it! It's not that good fix, but still.

File: CCWinRTUtils.cpp Method: createMappedCacheFile

I have commented if/else construction and call FileUtils::getInstance()->removeFile(prevFile) all the time.

Now it works fine on both Windows10 and Windows Phone 8.1.

As I understand now the caching works only for current session. The previous solution (caching by hashtag) was for caching sounds loaded from the Internet and not needed for local files.

answered on Stack Overflow Dec 30, 2015 by Rodion

User contributions licensed under CC BY-SA 3.0