-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAIIOM.note.js
32 lines (28 loc) · 846 Bytes
/
AIIOM.note.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
/*
Implemented:
- Play note C3
*/
function initNote() {
// Creating views
trackBank = host.createTrackBank(1, 1, 1, true); // Number of tracks, sends, scenes, hasFlatList
cursorTrack = host.createCursorTrack(1, 1); // Track cursor
trackBank.followCursorTrack(cursorTrack); // Sync cursor track of view and script
return onMidiNote;
}
function onMidiNote(status, data1, data2) {
// Check if message is MIDI CC
if (isChannelController(status)) {
switch (data1) {
case BUTTON_08_MIDINOTE:
handleNote(data2);
break;
}
}
}
function handleNote(value) {
if (buttonValueToBoolean(value)) {
trackBank.getItemAt(0).startNote(NOTE_NUMBER, NOTE_VELOCITY);
} else {
trackBank.getItemAt(0).stopNote(NOTE_NUMBER, NOTE_VELOCITY);
}
}