SoundPan
SoundPan SoundIndex, PanningValue
 
Parameters:

    SoundIndex = The Index identifier of sound you wish the change the volume of
    PanningValue = The panning of this sound. (-255 to 255)
Returns: NONE
 

SoundPan will set the play back panning of this sound.

Panning lets you control from what direction a sound is heard. So sound can be played directly in front (center) or off the either side (left or right), even pan from one side to another.

By default sounds are panned to be centered (panning value of zero), so if your computer speakers are directly in front of you, then the sound should appear to be evenly spread between them. Like wise when a sound is panned to the LEFT (Pan value of -255) or Right (255) it appear to be coming some that side/speaker

Sound pan values range between -255 and 255.

[ Panning Values ]
  
  <b>-255 To -1</b>= Negative pan values move the sound To the left.
  The lower the value the further left it will be.
  
  <b>        0 </b>= Dead in the center
  
  <b> 1 To 255 </b>= Positive pan values move the sound To the right.
  The Higher the value the further right it will be.
  




FACTS:


* SoundPan values range between -255(left) to 255(right).

* Changing SoundPan while a sound is playing, will alter the play back panning also.





Mini Tutorial:


This example loads a sound file as sound #1, sets it to loop and plays it.

Then during the main Do/Loop section of the code, it is constantly adjusting the sounds play back panning, to shift the looping sound from Left to Right.

  
  
; Load the Sound File "Explosion.wav" as sound #1
  LoadSound "explosion.wav",1
  
; Set sound to loop automatically once played
  LoopSound 1
  
; Begin playing the looped sound
  PlaySound 1
  
; Start a Do/loop
  Do
   ;Clear the Screen top black
     Cls RGB(0,0,0)
     
   ; display a message
     Print "Sound Is Panning"
     
   ; Bump the Angle# variable by 1
     angle#=WrapAngle(angle#,1)
     
   ; Set the sound 1 to Pan left/right under a cosine
     SoundPan 1,CosRadius(angle#,255)
     
   ; Display the sound #1's curremt panning value
     Print GetSoundPan(1)
     
   ; display the screen
     Sync
   ; Loop back to the DO statement.
  Loop
  



 
Related Info: GetSoundFreq | GetSoundMasterVolume | GetSoundPan | GetSoundPlaying | GetSoundQuantity | GetSoundVolume | PlaySound | SoundFreq :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com