FreeSound()

Syntax

FreeSound(#Sound)
Description
Stops and removes a sound previously loaded with LoadSound() or CatchSound() from memory. Once a sound has been freed, it can't be played anymore.

Parameters

#Sound The sound to free. If #PB_All is specified, all the remaining sounds are freed.

Return value

None.

Remarks

All remaining sounds are automatically freed when the program ends.

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)
      
      MessageRequester("Info", "Ok to stop.")
      
      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

Supported OS

All

<- CatchSound() - Sound Index - GetSoundFrequency() ->