的Soundpool只能播放第一个5秒的文件。为什么?第一个、文件、Soundpool

2023-09-13 01:10:38 作者:岁月并非如歌

我在我的应用程序中使用的Soundpool,到目前为止,它的作品不错,但我有一个wav文件是10秒。不幸的是,只的Soundpool播放第一5秒。如何使的Soundpool玩全程跟踪?我已经转换为WAV - OGG和MP3仍然是同样的问题。它仅播放第一5秒。任何帮助将是非常美联社preciated。

I use Soundpool in my app, so far it works good, but I do have a wav file which is 10 secs. Unfortunately, soundpool plays only the first 5 secs. How to make soundpool to play the whole track? I have converted wav to -- ogg and mp3 still the same issue. It plays only the first 5 secs. Any help would be much appreciated.

//set up audio player
mSoundPool = new SoundPool(20, AudioManager.STREAM_MUSIC, 0);
//load fx
mSoundPoolMap.put(RAW_1_1, mSoundPool.load(this, R.raw.loop1, 1));
//playing soundpool
case R.id.button1:          
mSoundPool.stop(mStream1);
mStream1= mSoundPool.play(mSoundPoolMap.get(RAW_1_1), streamVolume, streamVolume, 1, LOOP_1_TIME, 1f);

UPD尾:也许有人会在这里找到它,阅读它。似乎的Soundpool不能打多了,然后5秒。这是他最大的,更多的声音不再使用的MediaPlayer。我希望你不会花你的时间这么像我一样)

UPD Last: Maybe someone will find it here and read it. Seems soundpool cant play more then 5 secs. It is his maximum, for more longer sounds use MediaPlayer. I hope you will not spend so much of your time like i did)

推荐答案

所以,我觉得你达到了1M极限的Soundpool。

So I think you reached the 1M limit in SoundPool.

的Soundpool很难$ C C缓冲区大小为1M $,对所有加载的文件,存放在PCM格式。

SoundPool is hard code the buffer size as 1M, for all loaded file, store in pcm format.

所以,不在乎OGG和WAV的。

So it do not care of ogg or wav.

 
精彩推荐