资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

cocos2d-x同时播放多个音效的问题-创新互联

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

10年积累的成都网站制作、成都网站设计、外贸营销网站建设经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先建设网站后付款的网站建设流程,更有纳溪免费网站建设让你可以放心的选择与我们合作。

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

private static final int MAX_SIMULTANEOUS_STREAMS_DEFAULT = 5;

SoundPool构造的时候要指定并发音频流的数量

public SoundPool (int maxStreams, int streamType, int srcQuality)

Added in API level 1

This constructor was deprecated in API level 21.
use SoundPool.Builder instead to create and configure a SoundPool instance

Constructor. Constructs a SoundPool object with the following characteristics:

Parameters
maxStreamsthe maximum number of simultaneous streams for this SoundPool object
streamTypethe audio stream type as described in AudioManager For example, game applications will normally use STREAM_MUSIC.
srcQualitythe 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),可以手动改大一点,来解决问题

版本:cocos2d-x 3.0

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


网站题目:cocos2d-x同时播放多个音效的问题-创新互联
文章地址:http://cdkjz.cn/article/ededd.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220