I use SoundPool to play sfx sounds in an Android game. In most cases, it works fine, except that sometimes I need to stop all sounds at the same time without a pause (it does not matter if they are set in a loop or not). I canβt figure out how to stop a sound from playing without knowing the StreamID that sound. What i know:
soundpool.load( ... some sound ... ) returns soundIDsoundpool.play( soundID ) plays the sound and returns streamIDsoundpool.stop( streamID ) stops the sound
My question is: how can I stop the sound without knowing the streamID ? I tried to keep track of all the data streams in the list, but sometimes there are so many short streams that they will not work. And I can not find any method in SoundPool to get active streamID. Does anyone know how to stop all sounds? Any hint is appreciated! thanks
source share