I had issues with this too, converting all music to mp3 fixed it. I think there are weird bugs in soundpool relating to sample rates with wav files.
On Nov 25, 2:49 pm, Jags <jag...@gmail.com> wrote: > i am trying to play continuous background music using sound pool > > here is my code > > private void initSounds() { > soundPool = new SoundPool(4, AudioManager.STREAM_MUSIC, 100); > soundPoolMap = new HashMap<Integer, Integer>(); > soundPoolMap.put(SOUND_1, soundPool.load(getBaseContext(), > R.raw.one, 1)); > soundPoolMap.put(SOUND_2, soundPool.load(getBaseContext(), > R.raw.two, 1)); > soundPoolMap.put(SOUND_3, soundPool.load(getBaseContext(), > R.raw.three, 1)); > soundPoolMap.put(SOUND_4, soundPool.load(getBaseContext(), > R.raw.four, 1)); > } > > public void playSound(int sound, boolean loop) { > int looping = loop ? -1 : 0; > AudioManager mgr = (AudioManager) > getBaseContext().getSystemService( > Context.AUDIO_SERVICE); > int streamVolume = > mgr.getStreamVolume(AudioManager.STREAM_MUSIC); > soundPool.play(soundPoolMap.get(sound), streamVolume, > streamVolume, > 1, > looping, 1f); > } > > when i do playSound() with 1, 2, 3 sound [wav file] with looping > false, they play fine. but if i call playSound any of the 4 files with > looping true, it does not work. > > 4th one is an mp3 file which neither plays with looping true nor > looping false. > > can i create another mediaplayer object as a member variable and use > it for only background music ? > > regards > Jagat -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en