Soundpool won't load my files

NeoTechni

Well-Known Member
Licensed User
Longtime User
I'm using the same data (path, filename) and the OGGs load fine in the MediaPlay object, but when I use the Soundpool's Load method, it always returns 0 as the LoadID.

All but 1 file is under 10 KB, the other is 20 KB. So I know I'm not going over the 1 MB limit.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I've tested boom.ogg and it plays fine:
B4X:
Sub Process_Globals
   Dim sp As SoundPool
   Dim boom As Int
End Sub

Sub Globals

End Sub

Sub Activity_Create(FirstTime As Boolean)
   If FirstTime Then
      sp.Initialize(4)
      boom = sp.Load(File.DirAssets, "boom.ogg")
      Log(boom)
   End If
End Sub
Sub Activity_Click
   Log(sp.Play(boom, 1, 1, 1, 1, 1))
End Sub
Please try the above code.
 
Upvote 0
Top