I have a soundpool object and several sounds, but once created I can’t change the sounds playback in anyway, such as number of loops, volume, stopping, etc.
Declaration code:
public SoundPool sounds;
public HashMap<Integer, Integer> soundmap = new HashMap<Integer, Integer>();
static final public int UFO=3;
static final public int PlayerDeath=3;
static final public int InvaderDeath=2;
static final public int PlayerFire=1;
Sound assignment code:
sounds = new SoundPool(10,AudioManager.STREAM_MUSIC,0);
soundmap.put(PlayerDeath,sounds.load(getContext(), R.raw.explosion, 1));
soundmap.put(InvaderDeath,sounds.load(getContext(), R.raw.invaderkilled, 1));
soundmap.put(PlayerFire,sounds.load(getContext(),R.raw.shoot, 1));
soundmap.put(UFO,sounds.load(getContext(),R.raw.ufo, 1));
Start/stop code:
public void PlayUFOMusic()
{
sounds.play(soundmap.get(UFO),0.8F,0.8F,1,2000,1);
}
public void StopUFOMusic()
{
sounds.stop(soundmap.get(UFO));
}
I know these functions are being called but nothing will cause it change in anyway. I’ve also tried setLoop, setVolume, pause and unload, none of these worked either.
Any ideas?
Here is the play() syntax:
So shouldn’t it be:
to make the sound loop forever?
Edit: Read the question a bit to fast but if you use this play function, does it loop?