cocos2d-x 同时播放多个音效的问题

本文出自 “YYBear笔记博客,请务必保留此出处http://www.jb51.cc/article/p-ajkmvksx-hw.html

cocos2d-x 同时播放多个音效的时候,会发现有的音效放不出,有的循环音效放着放着就没了

后来发现猫腻在Cocos2dxSound.java里:

private static final int MAX_SIMULTANEOUS_STREAMS_DEFAULT = 5;


本人讲此值修改为:20


Added in API level 1

This constructor was deprecated in API level 21.

useSoundPool.Builderinstead to create and configure a SoundPool instance

Constructor. Constructs a SoundPool object with the following characteristics:

Parameters
maxStreams the maximum number of simultaneous streams for this SoundPool object
streamType the audio stream type as described in AudioManager For example,game applications will normally useSTREAM_MUSIC.
srcQuality the sample-rate converter quality. Currently has no effect. Use 0 for the default.
Returns
  • a SoundPool object,or null if creation Failed


这里cocos2d-x设置成5了(I9100设成3),可以手动改大一点,来解决问题

相关文章

    本文实践自 RayWenderlich、Ali Hafizji 的文章《...
Cocos-code-ide使用入门学习地点:杭州滨江邮箱:appdevzw@1...
第一次開始用手游引擎挺激动!!!进入正题。下载资源1:从C...
    Cocos2d-x是一款强大的基于OpenGLES的跨平台游戏开发...
1.  来源 QuickV3sample项目中的2048样例游戏,以及最近《...
   Cocos2d-x3.x已经支持使用CMake来进行构建了,这里尝试...