cocos2d-x 同時播放多個音效的問題

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
  • a SoundPool object, or null if creation failed


這裏cocos2d-x設置成5了(I9100設成3),可以手動改大一點,來解決問題



版本:cocos2d-x 3.0




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章