StopSound()

Syntax

StopSound(#Sound [, Channel])
Description
Stops the specified sound (if it was playing).

Parameters

#Sound The sound to stop. If this value is set to #PB_All, then all sounds currently playing are stopped.
Channel (optional) The channel to use. It's the value returned by PlaySound() when using the #PB_Sound_MultiChannel flag.

Return value

None.

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")
      ; The sound is playing
      PlaySound(0, #PB_Sound_Loop, 20)
      
      MessageRequester("Info", "Ok to stop.")
      
      StopSound(0)
      MessageRequester("Info", "Sound stopped")
      
      FreeSound(0) ; The sound is freed
      End
    EndIf
  Else
    Debug "Warning! The sound environment couldn't be initialized. So no sound commands can be used..."
  EndIf

See Also

PlaySound()

Supported OS

All

<- SoundVolume() - Sound Index