-
Notifications
You must be signed in to change notification settings - Fork 2
/
MIDI.pde
75 lines (64 loc) · 2.62 KB
/
MIDI.pde
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
void midiBusSetup() {
MidiBus.list(); // List all available Midi devices on STDOUT. This will show each device's index and name.
myBus = new MidiBus(this, 3, 3); // Create a new MidiBus with the right input and output to match AKAI APC40
}
//Simples MIDI Recieve Functions. Perhaps also worth checking out the classBased ones?
void noteOn(int channel, int pitch, int velocity) {
// Receive a noteOn
println();
println("Note On:");
println("--------");
println("Channel:"+channel);
println("Pitch:"+pitch);
println("Velocity:"+velocity);
//if (channel == 7 && pitch == 57 && velocity == 127) {
// bang();
//}
}
void noteOff(int channel, int pitch, int velocity) {
// Receive a noteOff
println();
println("Note Off:");
println("--------");
println("Channel:"+channel);
println("Pitch:"+pitch);
println("Velocity:"+velocity);
}
void controllerChange(int channel, int number, int value) {
// Receive a controllerChange
println();
println("Controller Change:");
println("--------");
println("Channel:"+channel);
println("Number:"+number);
println("Value:"+value);
//Base MIDI Controlls
//Still to do: How to control radiobuttons? How to set ranges?
if (channel == 0 && number == 48) {
cp5.get("base").setValue(int(map(value, 0, 127, baseMin, baseMax)));
} else if (channel == 0 && number == 49) {
cp5.get("baseThreshold").setValue(int(map(value, 0, 127, 100, 1)));
} else if (channel == 0 && number == 50) {
cp5.get("baseTimerThreshold").setValue(int(map(value, 0, 127, 0, 1000)));
} else if (channel == 0 && number == 51) {
baseClipsColumnsEffect.activate(round(map(value, 0, 127, 0, 2)));
}
//else if (channel == 0 && number == 52) {
// cp5.get("baseClipOrColumn").setValue(round(map(value, 0, 127, 1, 8)));
//}
//Snare MIDI Controls
else if (channel == 0 && number == 52) {
cp5.get("snare").setValue(int(map(value, 0, 127, snareMin, snareMax)));
} else if (channel == 0 && number == 53) {
cp5.get("snareThreshold").setValue(int(map(value, 0, 127, 100, 1)));
} else if (channel == 0 && number == 54) {
cp5.get("snareTimerThreshold").setValue(int(map(value, 0, 127, 0, 1000)));
} else if (channel == 0 && number == 55) {
snareClipsColumnsEffect.activate(round(map(value, 0, 127, 0, 2)));
}
//else if (channel == 0 && number == 20) {
// snareOscRange.setLowValue(map(value, 0, 127, 1, snareOscRange.getHighValue()));
//} else if (channel == 0 && number == 21) {
// snareOscRange.setHighValue(map(value, 0, 127, snareOscRange.getLowValue(), 6));
//}
}