I’m using 2.0.4, for some reason I skipped 2.0.3, although initially my game was written using 2.0.1.
In the end I’ve got working solution for sound in simulator with following procedure:
0) I’m using full file path to sound resource as suggested: CCFileUtils::fullPathFromRelativePath(“pew-pew-lei.wav”) and use ogg instead of mp3. (Honestly I didn’t try to play mp3, I simply converted my music to ogg).
1) preload all effects before playing them with playEffect(). That could be done at the start of the game or scene where they should be used.
2) For background music you must preload the file you want to play right before you start playing it, and you must stop playing previous track explicitly. This is very important if you want to play different music for different part of your game (e.g. one for menu and other for game scene)
3) Don’t try to preload all background music at once - you’ll get the latest preloaded track even though you will use different filename (yes, it’s weird). For example:
This will play menu.ogg even though I’ve asked for play.ogg~~ this is really weird but it behaves so for me on emulator.
4) If you forgot to stop currently playing background music then you’ll end up with 2 tracks playing simultaneously, but stopBackgroundMusic only stops the latest track.
So, in the end I wrote the following helper function to use instead of SimpleAudioEngine’s playBackgroundMusic:
CocosDenshion::SimpleAudioEngine *s_engine = CocosDenshion::SimpleAudioEngine::sharedEngine;
The number of wtf with Blackberry sound easily outperforms issues with sound on Android. %~~/
I hope we can test my port on real device soon.