Hello,
I'm using that sub see bellow after a Button_Click, with a "wait for" function :
but when there is many fast click, the sound disapear ...
Probably is there a buffer management for sound queue, or there is an other pb ?
Regards
Michel
I'm using that sub see bellow after a Button_Click, with a "wait for" function :
but when there is many fast click, the sound disapear ...
Probably is there a buffer management for sound queue, or there is an other pb ?
B4X:
Sub Process_Globals
Dim MP As MediaPlayer
End Sub
'after Button_Click
Wait For(audio.PlaySound("smallsound.mp3", 1500)) Complete (Result As Boolean)
'the rest of the code
'the Sub in audio module
Sub PlaySound(audiofile As String, DurSleep As Int) As ResumableSub
If Main.MusicEnable = True Then
If MP.IsInitialized = True Then
MP.Stop ' try to stop an previous playing if there is
MP.Release
End If
MP.Initialize2("MP")
MP.Load(File.DirAssets, audiofile)
MP.Play
End If
Sleep(DurSleep)
Return True
End Sub
Regards
Michel