I've succesfully loaded 250 ogg files (3 MB total) into memory, and play several of them at the same time using soundpool, unloading them, playing another bunch, etc.
This is an example. If you have 100 sounds under ./Files/snd/ named sound1.wav, sound2,wav ... sound99.wav, then:
B4X:
Dim soundsLoaded(100) As Int ' IDs of loaded sounds
Dim SP As SoundPool ' SoundPool Object
SP.Initialize(16) ' Max number of sounds in soundpool playing sametime
soundsPlaying(16) As Int ' Here are stored the IDs of the sounds playing, so we can stop them
Do While (i < 100)
filename = "sound" & i & ".wav"
soundsLoaded(i) = SP.Load(File.DirAssets, "subfolder/" & soundname )
i = i + 1
Loop
And:
B4X:
' To play a sound
soundsPlaying(0) = SP.Play(soundsLoaded(x), 1, 1, 1, 0, 1)
' To stop a sound
SP.Stop(soundsPlaying(X)) ' X should be a number from 0 to 15, in this case
' To stop all sounds
For n = 0 To 16
SP.Stop(soundsPlaying(X))
Next
I've succesfully loaded 250 ogg files (3 MB total) into memory, and play several of them at the same time using soundpool, unloading them, playing another bunch, etc.