I am having problem replaying a looped sound after stopping it. Log(PlayId1) shows that the value increase from 1, 2, 3, 4... each time I pressed the Start button.
Here's my sample code. I've also attached the sound file.
What am I missing here? Thanks for the help.
Here's my sample code. I've also attached the sound file.
B4X:
'Activity module
Sub Process_Globals
Dim SP As SoundPool
Dim LoadId1, PlayId1 As Int
End Sub
Sub Globals
Dim Button1 As Button
Dim Button2 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
SP.Initialize(1)
LoadId1 = SP.Load(File.DirAssets, "Clock ticking.ogg")
End If
Activity.LoadLayout("1")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
PlayId1 = SP.Play(LoadId1, 1, 1, 1, -1, 1)
Log(PlayId1)
End Sub
Sub Button2_Click
SP.Stop(PlayId1)
End Sub
What am I missing here? Thanks for the help.