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