-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path5.1_MultiChannel_Volume_Adjuster
78 lines (65 loc) · 1.69 KB
/
5.1_MultiChannel_Volume_Adjuster
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
desc:Multichannel 5.1 Level Adjuster (Tormy Van Cool) v1.3
/* tags: Multichannel 5.1 Levele Adjuster
author: Tormy van Cool
v1.0: Launch
v1.1: + function db2gain()
v1.2: - -120 +10
+ -30 +10
v1.3: + versioning into title
Copyright (C) 2023 Tormy van Cool
License: LGPL - http://www.gnu.org/licenses/lgpl.html
*/
slider1:0<-30,10,0.01>Left Output (dB)
slider2:0<-30,10,0.01>Right Output (dB)
slider3:0<-30,10,0.01>Center Output (dB)
slider4:0<-30,10,0.01>LFE Output (dB)
slider5:0<-30,10,0.01>Left Surround [Ls] Output (dB)
slider6:0<-30,10,0.01>Right Surround [Rs Output (dB)
in_pin:Left input
in_pin:Right input
in_pin:Center input
in_pin:LFE input
in_pin:Left Surround [Ls] input
in_pin:Right Surround [Rs] input
out_pin:Left output
out_pin:Right output
out_pin:Center output
out_pin:LFE output
out_pin:Left Surround [Ls] output
out_pin:Right Surround [Rs] output
@init
ext_tail_size = -2;
gainMin = -30;
gainMax = 10;
@slider
// Clamp to repectable values
slider1 = min(max(slider1, gainMin), gainMax);
slider2 = min(max(slider2, gainMin), gainMax);
slider3 = min(max(slider3, gainMin), gainMax);
slider4 = min(max(slider4, gainMin), gainMax);
slider5 = min(max(slider5, gainMin), gainMax);
slider6 = min(max(slider6, gainMin), gainMax);
function db2gain(db)
(
2^(db/6); // good enough approx
);
gain1 = db2gain(slider1);
gain2 = db2gain(slider2);
gain3 = db2gain(slider3);
gain4 = db2gain(slider4);
gain5 = db2gain(slider5);
gain6 = db2gain(slider6);
@sample
// Catch the inputs
in1 = spl0;
in2 = spl1;
in3 = spl2;
in4 = spl3;
in5 = spl4;
in6 = spl5;
spl0 = (in1 * gain1);
spl1 = (in2 * gain2);
spl2 = (in3 * gain3);
spl3 = (in4 * gain4);
spl4 = (in5 * gain5);
spl5 = (in6 * gain6);