I am using the Audio Lib 1.63. And I am using Soundpool to play a quick "beep" file.
This is my code:
But, intermittently, the first time I try to play a file after the app starts, it wont play, other times it will. And all subsequent attempts to play the same sound in the same app session work 100%. So it just sometimes has issues on the first attempt to play something.
So, I added some retry and diag code:
And when it failed (didn't hear the sound), it said the pid was "1", so it appears there wasn't an error.
Does anyone have an idea why it *intermittently* wont play, but doesn't report an error?
This is my code:
B4X:
pid = VoiceIt.SP.Play(StartBeep, 1, 1, 10, 0,0)
But, intermittently, the first time I try to play a file after the app starts, it wont play, other times it will. And all subsequent attempts to play the same sound in the same app session work 100%. So it just sometimes has issues on the first attempt to play something.
So, I added some retry and diag code:
B4X:
SP.Initialize(2)
StartBeep = VoiceIt.SP.Load(File.DirAssets,"beep.ogg")
StopBeeps = VoiceIt.SP.Load(File.DirAssets,"2-beeps.ogg")
Dim i, pid As Int
For i = 1 To 1000
pid = VoiceIt.SP.Play(StartBeep, 1, 1, 10, 0,0)
If (pid > 0) Then
ToastMessageShow("PlayBeep: Pid=" & pid,True)
Exit
Else
Log("PlayBeep: Pid=0, i=" & i)
End If
Next
And when it failed (didn't hear the sound), it said the pid was "1", so it appears there wasn't an error.
Does anyone have an idea why it *intermittently* wont play, but doesn't report an error?