Result = PlaySound(#Sound [, Flags [, Volume]])
Start to play the specified sound.


#Sound The sound to play.
Flags (optional) It can be a combination of the following values:
  #PB_Sound_Loop        : play the sound continuously (starts again when end is reached)
  #PB_Sound_MultiChannel: play the sound in a new channel instead of stopping the
        previously played sound. This allows to use the same sound and to play it on different
        channels at once. 'Result' will be new allocated channel, and can be used by the
        other sound commands like SoundVolume(), SoundPan() etc.
Volume (optional) Sets the initial volume of the #Sound. The valid values are from 0 (no volume) to 100 (full volume). The default value is 100.

Return value

The channel number, if the #PB_Sound_MultiChannel flag is used.


 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, 20)
 MessageRequester("Info", "Ok to stop.")
 FreeSound(0) ; The sound is freed

See Also

StopSound(), FreeSound(), PauseSound(), ResumeSound()

Supported OS


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