SoundPan()

Syntax

SoundPan(#Sound, Pan [, Channel])
Description
Sets the new pan value, in real-time, for the #Sound. The pan value is saved for the #Sound, so it's not needed to call it every time. The panning is a way to play a sound on a stereo equipment.

Parameters

#Sound The sound to use.
Pan The new pan value. Valid values are from -100 (full left) to 100 (full right). If the pan value is zero, then the sound is played on right and left speaker, equally.
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", "The sound is playing in stereo.")
      
      SoundPan(0, -100)
      MessageRequester("Info", "The sound is playing only on the left channel.")
      
      SoundPan(0, 100)
      MessageRequester("Info", "The sound is playing only on the right channel.")
      
      SoundPan(0, 0)
      MessageRequester("Info", "The sound is playing in stereo.")
      
      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

Windows, MacOS X

<- SoundLength() - Sound Index - SoundStatus() ->