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

发布时间:2020-06-26 21:49:38 作者:yaoyinbear
来源:网络 阅读:3061

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

后来发现猫腻在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


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



版本:cocos2d-x 3.0




推荐阅读:
  1. 十一 手游开发神器 cocos2d-x editor 之音乐和音效
  2. cocos2d-x 如何制作一个类马里奥的横版平台动作游戏续 2

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

soundpool cocos2d-x 音效

上一篇:jquery的一些小技巧

下一篇:数据结构(05)_链表01(单链表、静态单链表、单向循环链表)

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》