-
Notifications
You must be signed in to change notification settings - Fork 0
/
fx_rack.ck
56 lines (39 loc) · 949 Bytes
/
fx_rack.ck
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
HidMsg msg;
Hid hiKb;
Echo echo;
JCRev reverb;
Gain adcGain;
// Set Gain .gain parameter
1.0 => adcGain.gain;
// Set Delay parameters .max and .delay
.45::second => echo.max => echo.delay;
// Open the device
0 => int device;
if( !hiKb.openKeyboard( device ) ) me.exit();
// Patch
adc => adcGain => echo => reverb => dac;
// Define function gainController
fun void gainController(Gain g) {
while(true) {
// Event from the keyboard received
hiKb => now;
if (hiKb.recv(msg)) {
if( msg.isButtonDown() ) {
// Down Arrow Key
if (msg.which == 81) {
adcGain.gain() - 0.5 => adcGain.gain;
}
// Up Arrow Key
if (msg.which == 82) {
adcGain.gain() + 0.5 => adcGain.gain;
}
}
}
}
}
//spawn gainController function.
spork ~ gainController(adcGain);
// infinite time loop
while( true ) {
1::second => now;
}