A question on a small working code.
Posted: Mon Apr 08, 2024 1:59 pm
I have a question. Can anyone explain to me why I have to click in the main browser window to hear the sound?
Below is the code which apparently works very well, apart from this small detail. What did I forget? Thanks in advance.
Below is the code which apparently works very well, apart from this small detail. What did I forget? Thanks in advance.
Code: Select all
Global Start = ElapsedMilliseconds()
If InitSound()
Debug "initsound MainForm OK"
EndIf
#Sound1 = 1
Procedure TimerEvent()
Debug "Elapsed time in ms: " + Str(ElapsedMilliseconds()-Start)
PlaySound(#Sound1)
EndProcedure
Procedure Loading(Type, Filename$)
OpenWindow(0, 0, 0, 100, 100, "Timer", #PB_Window_Invisible)
;SetActiveWindow(0)
AddWindowTimer(0, 0, 1000)
EndProcedure
Procedure LoadingError(Type, Filename$)
Debug Filename$ + ": loading error"
EndProcedure
BindEvent(#PB_Event_Loading, @Loading())
BindEvent(#PB_Event_LoadingError, @LoadingError())
BindEvent(#PB_Event_Timer, @TimerEvent())
LoadSound(#Sound1, "./res/Sounds/Recording_10.mp3")