-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMidiChannelSwitcher.js
41 lines (37 loc) · 1021 Bytes
/
MidiChannelSwitcher.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
/* Switch MIDI channel dynamically with CC
v.1
Updates: https://github.com/viovar-black/logic_pro_scripts/blob/master/scripts/MidiChannelSwitcher.js
Ch. Switch CC - CC message to switch the MIDI channel, CC#0 (bank) by default
Channel - channel to re-route CC messages to
All - re-route all events including notes, aftertouch, etc.
*/
var PluginParameters = [
{
name: "Switch CC",
type: "lin",
minValue: 0,
maxValue: 127,
numberOfSteps: 127,
defaultValue: 0
},
{
name: "Channel",
type: "lin",
minValue: 1,
maxValue: 16,
numberOfSteps: 15,
defaultValue: 0
}
];
function HandleMIDI(event) {
if (event instanceof ControlChange) {
if (event.number === GetParameter("Switch CC")) {
SetParameter("Channel", Math.min(event.value + 1, 16))
} else {
event.channel = GetParameter("Channel");
event.send();
}
} else {
event.send();
}
}