SoundStatus()

Syntax

Result = SoundStatus(#Sound [, Channel])
Description
Get the current sound status.

Parameters

#Sound The sound to use.
Channel (optional) The channel to use. It's the value returned by PlaySound() when using the #PB_Sound_MultiChannel flag.

Return value

The current sound status. It can be one of the following value:
  #PB_Sound_Stopped: the sound is stopped.
  #PB_Sound_Playing: the sound is playing.
  #PB_Sound_Paused : the sound is paused.
  #PB_Sound_Unknown: the sound is in an unknown state (an error occurred when getting the state).

Example

  Procedure SelectStatus(Status)
    Select Status
      Case #PB_Sound_Stopped
        MessageRequester("Info", "The sound is stopped.")
        
      Case #PB_Sound_Playing
        MessageRequester("Info", "The sound is playing.")
        
      Case  #PB_Sound_Paused
        MessageRequester("Info", "The sound is paused.")
        
      Case #PB_Sound_Unknown
        MessageRequester("Info", "Status unknown.")
        
      Default
        MessageRequester("Info", "Status unknown.")
        
    EndSelect
  EndProcedure

 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)
 SelectStatus(SoundStatus(0))

 PauseSound(0)
 SelectStatus(SoundStatus(0))
 
 ResumeSound(0)
 SelectStatus(SoundStatus(0))
 
 StopSound(0)
 SelectStatus(SoundStatus(0))
 
 FreeSound(0) ; The sound is freed
 End

Supported OS

All

<- SoundPan() - Sound Index - SoundVolume() ->