/
GeluidKrasserStart.scd
41 lines (36 loc) · 1.02 KB
/
GeluidKrasserStart.scd
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
(
// User configuration
var bufferLengths = [20, 20, 20, 20]; // length of the 4 buffers, in seconds
var showMidiInput = false;
// Any changes to the code below is on your own risk
var screenWidth = Window.screenBounds.width, screenHeight = Window.screenBounds.height;
var wDummy = Window().front.close; // to prevent main window to start hidden behind sclang
var version = "1.0.0";
var wGeluidKrasser = Window("GeluidKrasser v" ++ version, Rect(0,0,screenWidth,screenHeight)).background_(Color.grey(0.8,0.2));
var geluidKrasser = Array.newClear(4);
var instances = [0,1,2,3];
MIDIIn.connectAll;
instances.do { arg id;
geluidKrasser[id] = GeluidKrasser.new(
id,
s,
wGeluidKrasser,
bufferLengths[id],
showMidiInput,
);
};
wGeluidKrasser.view.keyDownAction = {
arg view, char, modifiers, unicode, keycode, key;
if (keycode == 37) { // L
instances.do { arg id;
geluidKrasser[id].clearBuffer();
};
};
};
wGeluidKrasser.onClose = {
instances.do { arg id;
geluidKrasser[id].cleanUp();
};
};
wGeluidKrasser.front();
)