Soundpool plays only first 5 secs of file. Why?

android, soundpool

Solution

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

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

So it do not care of ogg or wav.

Problem

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 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)

Original source