The main idea here is that one slider controls the range, and the other controls the volume. There are two versions: one can boost, the other cannot.
Boost and Attenuate
// This effect Copyright (C) 2004 and later Cockos Incorporated
// License: LGPL - http://www.gnu.org/licenses/lgpl.html
desc: JDA Volume Adjustment
//tags: utility gain
//author: John Allsup based on "volume adjustment" by Cockos
slider1:12<0,60,0.1>Adjustment Range (dB)
slider2:0<-100,100,0.1>Adjustment Amount (%)
slider3:0<-50,50,0.1>Max Volume (dB)
in_pin:left input
in_pin:right input
out_pin:left output
out_pin:right output
@slider
s1 = slider1;
s2 = slider2;
s = slider1*slider2/100.0;
adj1=2 ^ (s/6);
adj2=2 ^ (slider3/6);
doseek < 0 ? doseek = 1;
@block
doseek > 0 ? (
dadj=(adj1-adj1_s)/samplesblock;
):(
dadj=0;
adj1_s=adj1;
);
doseek = -1;
@sample
spl0=min(max(spl0*adj1_s,-adj2),adj2);
spl1=min(max(spl1*adj1_s,-adj2),adj2);
adj1_s+=dadj;
Attenuate Only
// This effect Copyright (C) 2004 and later Cockos Incorporated
// License: LGPL - http://www.gnu.org/licenses/lgpl.html
desc: JDA Volume Adjustment Negative Only
//tags: utility gain
//author: John Allsup based on "volume adjustment" by Cockos
slider1:12<0,60,0.1>Adjustment Range (dB)
slider2:0<-100,0,0.1>Adjustment Amount (%)
slider3:0<-50,50,0.1>Max Volume (dB)
in_pin:left input
in_pin:right input
out_pin:left output
out_pin:right output
@slider
s1 = slider1;
s2 = slider2;
s = slider1*slider2/100.0;
adj1=2 ^ (s/6);
adj2=2 ^ (slider3/6);
doseek < 0 ? doseek = 1;
@block
doseek > 0 ? (
dadj=(adj1-adj1_s)/samplesblock;
):(
dadj=0;
adj1_s=adj1;
);
doseek = -1;
@sample
spl0=min(max(spl0*adj1_s,-adj2),adj2);
spl1=min(max(spl1*adj1_s,-adj2),adj2);
adj1_s+=dadj;