We’ve been getting frequent reports from users about our game crashing halfway through our tutorial on GT-I9100 devices, and we wasted considerable time trying to dig into it before finally just buying an I9100 and debugging locally. Once we had the device, it was nearly trivial to find out that it was caused by loading too many sound effects.
Now, on researching specifically that issue, it’s clear in http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Use_OpenSL_ES_to_play_effect_on_Android that there’s a limit to 31 sound effects.
I have 2 points to make here:
- That limitation is hard to discover and causes an app crash.
- It should be very easy to build in safety checks to the OpenSLEngine.cpp. Either a system that tracks the loaded effects and unloads, the oldest when you try to play a new effect, or simply a system that stops playing new effects when you get over the limit. Lack of audio or more delays to play effects is a much preferred outcome over an app crash.
I’m going to be implementing a system to unload older effects, but I’ll be implementing it in JS,where it won’t be very useful to anyone not using JS Bindings. It’d probably be a very good idea for someone to implement some safety checks into the C++ code
Something like 50% of our app’s 1 star ratings were caused by this bug, and we’ve had to disable the I9100 for our last couple of releases.