desc:VCA slave

in_pin:audio in L
in_pin:audio in R
in_pin:controller in L
in_pin:controller in R
out_pin:audio out L
out_pin:audio out R


slider1:50<0,300,1>transition time (ms)

@init
curgain=0.0;
curgain2=0.0;
reflevel = 10^(30/20);


@slider
sc = exp(-1.0 / (slider1*0.001*srate));
sc2 = (1-sc)*reflevel;

@sample

spl0 *= (curgain = curgain * sc + min(abs(spl2),8.0)*sc2);
spl1 *= (curgain2 = curgain2 * sc + min(abs(spl3),8.0)*sc2);