-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApplicationHandler.js
45 lines (36 loc) · 1.24 KB
/
ApplicationHandler.js
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
load("Constants.js");
var detailState = false;
ApplicationHandler = (application, hardware) => {
this.application = application;
this.hardware = hardware;
};
ApplicationHandler.prototype.handleMidi = (status, data1, data2) => {
if (data2 == 0) return true;
if (isNoteOn(status)) {
switch (data1) {
case BUTTON_DETAIL:
detailState ? this.application.toggleDevices() : this.application.toggleNoteEditor();
this.hardware.updateChannelLed(true, 0, BUTTON_DETAIL);
detailState = !detailState;
return true;
case BUTTON_CLIP_TRACK:
this.application.nextPanelLayout();
this.hardware.updateChannelLed(true, 0, BUTTON_CLIP_TRACK);
return true;
default:
return false;
}
}
if (isNoteOff(status)) {
switch (data1) {
case BUTTON_DETAIL:
this.hardware.updateChannelLed(false, 0, BUTTON_DETAIL);
return true;
case BUTTON_CLIP_TRACK:
this.hardware.updateChannelLed(false, 0, BUTTON_CLIP_TRACK);
return true;
default:
return false;
}
}
};