I'm trying to play a background sound for my application, I use SoundPool class, my problem is that, sound plays well only when I set the loop parameter with zero value, but it doesn't work for any other value.
My code for initialization is:
soundpool = new SoundPool(4, AudioManager.STREAM_MUSIC, 0);
soundsMap = new HashMap<Integer, Integer>();
soundsMap.put(1, soundpool.load(this, R.raw.soundfile_1, 1));
soundsMap.put(2, soundpool.load(this, R.raw.soundfile_2, 1));
my code for playing is
soundpool.play(1, 0.9f, 0.9f, 1, -1, 1f);
as I mentioned sound works when I put (0) instead of (-1) for the loop value, anyone has any idea why (-1) or any value other than (0) doesn't work (there is no output sound) ?