I am trying to a warning sound upon certain conditions using SoundPool.
It reacts inconsistently on one and among several devices. It sometimes plays the sound correctly, sometimes twice, and sometimes not at all. On my Galaxy S2 all three occur - and I could not find any logic behind when each instance occur.
It is in a long program, so I cannot attach it, but the SoundPool parts are as follows:
Can anybody shed some light on this?
Is there a better (more consistent) way to make a warning sound?
Should I use Beeper or MediaPlayer instead?
Thanks for any help
It reacts inconsistently on one and among several devices. It sometimes plays the sound correctly, sometimes twice, and sometimes not at all. On my Galaxy S2 all three occur - and I could not find any logic behind when each instance occur.
It is in a long program, so I cannot attach it, but the SoundPool parts are as follows:
B4X:
Sub Process_Globals
.
.
Dim SP As SoundPool
.
.
End Sub
Sub Globals
.
.
Dim LoadDingDong As Int
Dim PlayDingDong As Int
.
.
End Sub
Sub Activity_Create(FirstTime As Boolean)
.
.
If FirstTime Then
.
.
SP.Initialize(4)
LoadDingDong = SP.Load(File.DirAssets,"DingDong.MP3")
.
.
End If
End Sub
Sub CheckConditions
.
.
If Cond1 = True Then
If Cond2 = True Then
If Cond3 = True Then
PlayDingDong = SP.Play(LoadDingDong,1,1,1,0,1)
Result = Msgbox2(message,warning,option1,option2,option3,Null)
Select Result
.
.
End If
End If
End If
End Sub
Can anybody shed some light on this?
Is there a better (more consistent) way to make a warning sound?
Should I use Beeper or MediaPlayer instead?
Thanks for any help