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://hxwzsj.com/article/ededd.html

其他资讯

Copyright © 2025 青羊区翔捷宏鑫字牌设计制作工作室(个体工商户) All Rights Reserved 蜀ICP备2025123194号-14
友情链接: 网站建设公司 成都网站建设 成都定制网站建设 企业网站建设 网站建设方案 成都定制网站建设 网站制作 成都网站设计 高端网站设计 教育网站设计方案 成都营销网站建设 成都网站建设 成都网站制作 自适应网站建设 重庆网站制作 高端定制网站设计 成都网站建设公司 成都网站设计 定制级高端网站建设 成都网站建设推广 成都品牌网站建设 成都网站设计