Android Question Soundpool Clips Playback

RichardN

Well-Known Member
Licensed User
Longtime User
I have an app that should play a certain 'jingle' when required by program activity. I realise the Audio Lib Soundpool object has limitations but I have a 10 second 'jingle' (~300kb) that completely refuses to play more than the first ~6 seconds before cutting out.

I have tried .mp3 / .wav / .ogg files all of various bitrates. I thought maybe it was a memory issue so tried 'Large Heap' in the manifest but all with no success. Strangely it always cuts at precisely the same point irrespective of soundfile type, size or bit-rate. I am using the following code:

B4X:
Sub Process_Globals
    Dim Sp As SoundPool
End Sub

Sub Globals
    Dim Jingle As Int
End Sub

Sub Activity_Create(FirstTime As Boolean)

    If FirstTime Then
        Sp.Initialize(1)
        Jingle = Sp.Load(File.DirAssets,"Jingle.ogg")
    End If

End Sub

Sub Activity_Resume
    Sp.Play(Jingle,1,1,1,0,1)
End Sub


Any ideas ???
 
Last edited:
Top