LoadSound()
Syntax
Result = LoadSound(#Sound, Filename$ [, Flags])Description
Load any sound format supported by the web browser from an URL.
Parameters
#Sound A number to identify the new sound. #PB_Any can be used to auto-generate this number. Filename$ The filename to use to load the sound. Flags (optional) Ignored.
Return value
Nonzero if the sound has been created, zero otherwise. The sound is still not loaded, the callbacks binded to #PB_Event_Loading and #PB_Event_LoadingError will be called once the loading is done. If #PB_Any was used for the #Sound parameter then the generated number is returned on success.
Example
InitSound() Procedure Loading(Type, Filename$, ObjectId) Debug Filename$ + " loaded (id = " + ObjectId + ")" PlaySound(0) ; play the sound EndProcedure Procedure LoadingError(Type, Filename$) Debug Filename$ + ": loading error" EndProcedure ; Register the loading event before calling any resource load command BindEvent(#PB_Event_Loading, @Loading()) BindEvent(#PB_Event_LoadingError, @LoadingError()) LoadSound(0, "Data/Lazer.wav") ; Be sure this sound is available (the source file should be saved in the SpiderBasic/Examples drawer)
See Also
FreeSound(), PlaySound()
Supported OS
All