-
Notifications
You must be signed in to change notification settings - Fork 0
/
AIIOM.device.js
37 lines (31 loc) · 880 Bytes
/
AIIOM.device.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
/*
Implemented:
- Effect on/off
*/
function initDevice() {
// Creating views
arrangerCursorDevice = host.createEditorCursorDevice();
arrangerCursorDevice.isEnabled().addValueObserver(function (deviceEnabled) {
if (deviceEnabled) {
host.getMidiOutPort(0).sendMidi(MIDI_CC, BUTTON_09_ONOFF, BUTTON_ON);
} else {
host.getMidiOutPort(0).sendMidi(MIDI_CC, BUTTON_09_ONOFF, BUTTON_OFF);
}
});
return onMidiDevice;
}
function onMidiDevice(status, data1, data2) {
// Check if message is MIDI CC
if (isChannelController(status)) {
switch (data1) {
case BUTTON_09_ONOFF:
handleDeviceOnOff(data2);
break;
}
}
}
function handleDeviceOnOff(value) {
if (buttonValueToBoolean(value)) {
arrangerCursorDevice.isEnabled().toggle();
}
}