InitSound()
Syntax
Result = InitSound([NbMaxChannels])Description
Initializes the sound environment. This function must be always called before any other sound function and should always check its result. If the sound environment fails, it's absolutely necessary to disable all the sound functions calls.
Parameters
NbMaxChannels (optional) Sets the maximum number of channels to use simultaneously to play sounds. It can range from 1 to 254 (the default value if this parameter is not specified is 64).
Return value
Nonzero if the sound environment has been setup correctly, zero otherwise (for example if no sound card is available).
Example
If InitSound() ; Initialize Sound system UseOGGSoundDecoder() ; Use ogg files ; Loads a sound from a file If LoadSound(0, #PB_Compiler_Home +"Examples/3D/Data/Siren.ogg") PlaySound(0, #PB_Sound_Loop) ; Start playing the sound in a loop MessageRequester("Info", "Ok to stop.") FreeSound(0) ; The sound is freed EndIf End Else Debug "Warning! The sound environment couldn't be initialized. So no sound commands can be used..." EndIf
Supported OS
All