void GetTotalVolume(){
float totalVol = 0f;
foreach(Instrument instrument in instruments){
AudioSource source = instrument.sound;
float[] pass = new float[channels];
source.GetOutputData(pass, 0);
float passTotal=0f;
for(int i=0;i<channels;i++){
passTotal+=Mathf.Abs(pass[i]);
}
totalVol+=(passTotal/channels)*instrument.getVolume();
}
//totalVol = Mathf.Log10 (totalVol / sources.Length) * 20;
GetVolume (totalVol);
}
}