-
Notifications
You must be signed in to change notification settings - Fork 0
/
GLevelN.sc
44 lines (35 loc) · 870 Bytes
/
GLevelN.sc
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
GLevelN : CompositeView {
var levels;
*new {
arg parent, bounds = Rect(0, 0, 102, 160), number = 5;
^super.new(parent, bounds).init(number);
}
init {
arg num;
levels = Array.new(32);
num.do( {
arg i;
levels.add(GLevel.new(this, title: "ch" ++ i));
levels[i].moveTo(i * 25, 0);
levels[i].level.value = 0;
levels[i].level.peakLevel_(0);
});
super.resizeTo(num * 25, 160);
}
title {
arg idx, title;
levels[idx].title(title);
}
item {
arg idx;
^levels[idx];
}
value {
arg idx, amp;
levels[idx].level.value = amp.ampdb.linlin(-60, 0, 0, 1);
}
peakLevel {
arg idx, amp;
levels[idx].level.peakLevel_(amp.ampdb.linlin(-60, 0, 0, 1));
}
}