-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjuno-gi.control.js
142 lines (119 loc) · 3.97 KB
/
juno-gi.control.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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/*
Bitwig controller script for Roland JUNO-Gi
*/
loadAPI(1);
host.defineController("Roland", "JUNO-Gi", "0.1", "3e0908d1-7c12-49f6-a42f-349eabe7eb14");
host.defineMidiPorts(2, 2); // the number of MIDI ports
host.addDeviceNameBasedDiscoveryPair(["JUNO-Gi MIDI 1", "JUNO-Gi MIDI 2"], ["JUNO-Gi MIDI 1", "JUNO-Gi MIDI 2"]);
// M32 prefix for CC buttons, modes, etc.
var JUNOGi = {
TOP: 9,
REW: 19,
FF: 20,
STOP: 21,
PLAY: 22,
REC: 23,
SLIDER_0: 5, // Portament Time
SLIDER_1: 73, // Attack Time
SLIDER_2: 75, // Decay Time
SLIDER_3: 72, // Release Time
SLIDER_4: 91, // Reverb
SLIDER_M: 7, // Volume
SW_0: 16,
SW_1: 17,
SW_2: 18,
SW_3: 80,
SW_4: 81,
SW_M: 82,
KNOB_1: 10, // Panpot
KNOB_2: 76,
KNOB_3: 77,
KNOB_4: 78,
KNOB_5: 74,
KNOB_6: 71,
LOWEST_CC: 1,
HIGHEST_CC: 119
};
// Initialize
function init() {
// MIDI ports
host.getMidiInPort(0).setMidiCallback(onMidiPort1);
host.getMidiInPort(1).setMidiCallback(onMidiPort2);
generic = host.getMidiInPort(0).createNoteInput("MIDI Keyboard", "??????");
generic.setShouldConsumeEvents(false);
// Create host objects
transport = host.createTransport();
masterTrack = host.createMasterTrack(512);
tracks = host.createMainTrackBank(512,512,512);
cursorTrack = host.createCursorTrackSection(4,5);
}
// Actions for CC events arriving on MIDI port 1
function onMidiPort1(status, data1, data2) {
if (isChannelController(status)) {
if (data2 > 0) { // ignore button release
switch (data1) {
case JUNOGi.PLAY:
transport.play();
break;
case JUNOGi.STOP:
transport.stop();
break;
case JUNOGi.REC:
transport.record();
break;
case JUNOGi.TOP:
transport.setPosition(0);
break;
case JUNOGi.REW:
transport.rewind();
break;
case JUNOGi.FF:
transport.fastForward();
break;
case JUNOGi.SLIDER_0:
cursorTrack.getVolume().set(data2, 128);
host.showPopupNotification("Volume: " + data2);
break;
case JUNOGi.SLIDER_1:
tracks.getTrack(0).getVolume().set(data2, 128);
host.showPopupNotification("Track#1 Volume: " + data2);
break;
case JUNOGi.SLIDER_2:
tracks.getTrack(1).getVolume().set(data2, 128);
host.showPopupNotification("Track#2 Volume: " + data2);
break;
case JUNOGi.SLIDER_3:
tracks.getTrack(2).getVolume().set(data2, 128);
host.showPopupNotification("Track#3 Volume: " + data2);
break;
case JUNOGi.SLIDER_4:
tracks.getTrack(3).getVolume().set(data2, 128);
host.showPopupNotification("Track#4 Volume: " + data2);
break;
case JUNOGi.SLIDER_M:
masterTrack.getVolume().set(data2, 128);
host.showPopupNotification("Master Volume: " + data2);
break;
case JUNOGi.SW_0:
cursorTrack.getSolo.toggle();
break;
case JUNOGi.SW_1:
tracks.getTrack(0).getArm.toggle();
break;
case JUNOGi.SW_2:
tracks.getTrack(1).getArm.toggle();
break;
case JUNOGi.SW_3:
tracks.getTrack(2).getArm.toggle();
break;
case JUNOGi.SW_4:
tracks.getTrack(3).getArm.toggle();
break;
}
}
}
}
// Actions for CC events arriving on MIDI port 2
function onMidiPort2(status, data1, data2) {
}
function exit() {}