SoundVolume
SoundVolume SoundIndex, VolumeLevel
 
Parameters:

    SoundIndex = The Index identifier of sound you wish the change the volume of
    VolumeLevel = The volume of this sound. (range 0 to 255)
Returns: NONE
 

SoundVolume will set the play back volume of this sound. The volume ranges between zero and 255. Zero being the lowest and 255 being the highest.



FACTS:


* SoundVolume ranges between 0 and 255.
* Changing SoundVolume while the sound is playing, will change the play back volume of that sound also.




Mini Tutorial:


This example loads a sound file as sound #1, and sets it's play back volume to 100. The user is then prompted to press a key. When they do, the Sound is played. The program then waits until the sound has stopped playing, sets the volume higher and prompts the user again.



  
  
; Load the Sound File "Explosion.wav" as sound #1
  LoadSound "explosion.wav",1
  
; Set Sound #1 Play Back volume to 100
  SoundVolume 1,100
  
; Display the Status of Sound #1
  Print "Sound #1 Status:"+Str$(GetSoundStatus(1))
  
; Display it's current PLay abck volume
  Print "Sound #1 Play Back Volume:"+Str$(GetSoundVolume(1))
  
; Display a message asking the user to press any key
  Print "press Any key to play Sound"
  
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  WaitNoKey
  
; Play the sound
  PlaySound 1
  
; Wait for the sound to stop playing before continuing
  Repeat
     ThisSound=GetSoundPlaying(1)
  Until ThisSound=false
  
  
; Set Sound #1 Play Back volume to 250
  SoundVolume 1,250
  
; Display the Status of Sound #1
  Print "Sound #1 Status:"+Str$(GetSoundStatus(1))
  
; Display it's current PLay abck volume
  Print "Sound #1 Play Back Volume:"+Str$(GetSoundVolume(1))
  
  
; Play the sound again.
  PlaySound 1
  
  
  
; Display the Screen and wait for the user to press a key
  Print "press Any key to play Sound"
  Sync
  WaitKey
  
  



This example would output (as long as the sound loaded).

  
  Sound #1 Status:1
  Sound #1 Play Back Volume:100
  press Any key To play Sound
  Sound #1 Status:1
  Sound #1 Play Back Volume: 250
  Press Any key To play Sound
  

 
Related Info: GetSoundMasterVolume | GetSoundVolume | PauseSound | PlaySound | SoundFreq | SoundMasterVolume | SoundPan :
 


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