SoundMasterVolume
SoundMasterVolume VolumeLevel
 
Parameters:

    VolumeLevel = The overall volume of sound output. (0 to 255)
Returns: NONE
 

SoundMasterVolume is the master volume control for all sound output. Setting this value will alter the sound play back level of all sounds. So you can use this to fade play back or lower all sound play back at will, without having to manually fade each sound.




FACTS:


* Changing the global volume does not change the individual sounds internal volumes, rather it scales their play back volume while playing.




Mini Tutorial:


The following example code, loads a sound file as sound 1. During the main Do/Loop the program randomly plays this sound using different pannings/volumes and fequencys to create a sort of wall of noise effect. The user can then control the overall play back volume with the Up/Down arrows which set the sound outputs master volume.


  
; Load a sound into 1
  LoadSound "..\..\..\SFX\Out.wav",1
  
; Start of DO/LOOp
  Do
     
   ; Clear the Screen to Black
     Cls RGB(0,0,0)
     
   ; Display some messages to the screen
     Print "Randomly PLaying Dynamic Sounds"
     Print "Use Up/Down Arrows to Adjust Master Volume"
     
   ; Randonly play Sound #1 dynamically
     If Rnd(1000)>900
        panning=RndRange(-255,255)
        freq=RndRange(22000,44000)
        PlayDynamicSound 1,panning,Rnd(255),freq
     EndIf
     
   ; Get the current Master volume level
     v=GetSoundMasterVolume()
     
   ; Display a message with the current master volume
     Print "Current Sound Master Volume:"+Str$(v)
     
   ; IF the UPARROW is pressed and V is lower than 255
   ; THEN Set the master volume level to master plus 1
     If UpKey()=true And v<255 Then SoundMasterVolume v+1
     
   ; IF the DOWNARROW is pressed and V is Higher than 0
   ; THEN Set the master volume level to master minus 1
     If DownKey()=true And v>0 Then SoundMasterVolume v-1
     
   ; Display the Screen
     Sync
   ; Loop back to the DO statement
  Loop
  
  





 
Related Info: GetSoundMasterVolume | GetSoundVolume | LoadNewSound | LoadSound | PlaySound | SoundFreq | SoundVolume :
 


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