0
votes

I want to play a few sound effects with SimpleAudioEngine from cocos2d-x v3, some of them should repeat forever. Now when i start a sound effect with:

CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("mg.wav",true);

and play for example the following sound effect 31 times:

CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("box.wav");

my mg.wav stops. Thats because IOS and Android only allows 32 sound effects. But why is that a problem when i play 31 times the same sound effect? I thought that only counts for different effects?

Now how can I solve that issue? Background music would work fine, but i can only play one background music at the same time.

Kurt

1
Simple audio engine just uses the next channel whenever you play something, so with 32 sound effects all channels are used up and earlier sounds are stopped. You can't work around this with the "simple" audio engine but you'll have to set up at least two separate audio channels, one that reserves a channel for the looping audio which must never be interrupted, the other channel works just like before except with one less channel to work with. No idea how exactly to do that with cocos2d-x CD though, I just know it ought to be possible. Check the class reference. - LearnCocos2D

1 Answers

0
votes
CocosDenshion::SimpleAudioEngine::getInstance()->playEffect("fileName.mp3",true);