cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.28k stars 7.05k forks source link

The Strategy of playing more than 32 audios at the same time needs to be changed #17387

Open dumganhar opened 7 years ago

dumganhar commented 7 years ago

Please refer to https://github.com/cocos2d/cocos2d-x/pull/17233

Steps to Reproduce:

  1. Just AudioEngine::play2d(...) as many audios as possible
  2. The latest audio will not be played, there is an output log:
    Fail to play xxx.mp3 cause by limited max instance of AudioEngine.

HOW TO DO:

Basically, we need to modify the behavior of playing more than MAX instances (32). Currently, we just ignore the latest audio added to AudioEngine, IMO, this strategy doesn't make sense. We probably could take a look at SoundPool implementation in Android, which removes the oldest audio added to AudioEngine and re-uses it for the latest one.

piotrros commented 7 years ago

+1 I agree :D

piotrros commented 7 years ago

Any chance to add this "feature"? I'm really struggling with this issue A LOT.

stevetranby commented 6 years ago

Ideally one would mix the internal data buffer(s) if necessary (or always?) into a single or few channel(s) of actual playback. It's possible this is only practical on desktop and high-end mobile devices.