LoadSound()

Syntax

Result = LoadSound(#Sound, Filename$ [, Flags])
Description
Load a WAV (in PCM format, ADPCM is not supported) or any other format supported by the SoundPlugin library into memory. The following functions can be used to enable automatically more sound format:

UseFLACSoundDecoder()
UseOGGSoundDecoder()

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) It can be the following value:
  #PB_Sound_Streaming: Enable sound streaming playback (only supported for FLAC and OGG))

Return value

Nonzero if the sound has been successfully loaded, zero otherwise.

Example

 InitSound()           ; Initialize Sound system
 UseOGGSoundDecoder()  ; Use ogg files

 ; Loads a sound from a file
 LoadSound(0, #PB_Compiler_Home +"Examples\3D\Data\Siren.ogg")
 ; The sound is playing
 PlaySound(0, #PB_Sound_Loop)
 
 MessageRequester("Info", "Ok to stop.")
 
 FreeSound(0) ; The sound is freed
 End

See Also

CatchSound(), FreeSound(), PlaySound()

Supported OS

All

<- IsSound() - Sound Index - PauseSound() ->