-
Notifications
You must be signed in to change notification settings - Fork 1
/
vcombo-sysex-translator.jsfx
93 lines (85 loc) · 2.58 KB
/
vcombo-sysex-translator.jsfx
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
desc: V-Combo SysEx to MIDI CC
// TODO: Set fast/slow rotary button (currently sets 16' drawbar to 0/1)
@init
sysex_status_byte=0xF0;
cc_status_byte=0xB0;
drawbar_scale_factor=16; // Drawbars send values 0-8 but must be scaled to 0-127
output_channel=0x00;
drawbar_cc_start_num=0x0C;
@block
buf = 10000;
maxlen = 65536;
while ((recvlen = midirecv_buf(offset, buf, maxlen)) > 0) (
b01_status_byte = buf[0];
b08_control_index = buf[7];
b09_control_val = buf[8];
b10_checksum = buf[9];
//// SysEx:
b01_status_byte == sysex_status_byte ? (
//// Drawbars:
b08_control_index >= 3 && b08_control_index <= 11 ? ( // between 0x03 and 0x0B
drawbar_index = b08_control_index - 3;
drawbar_value = b09_control_val * drawbar_scale_factor;
drawbar_value > 127 ? (
drawbar_value = 127;
);
midisend(
offset,
cc_status_byte + output_channel,
drawbar_cc_start_num + drawbar_index,
drawbar_value
);
) : (
//// Buttons:
// NOTE: Buttons send weird double-messages. This isn't handled gracefully.
// "Percussion" button:
b08_control_index == 0x0D ? (
b09_control_val == 2 ? (
b09_control_val = 127;
);
cc_num = 102;
);
// "Vibrato/Chorus" button:
b08_control_index == 0x37 ? (
b09_control_val == 1 ? (
b09_control_val = 127;
);
cc_num = 106;
);
//// Knobs:
// "Overdrive" knob:
b08_control_index == 0x3F ? (
cc_num = 75;
);
// "Tone" knob:
b08_control_index == 0x61 ? (
cc_num = 76;
);
// "Compressor" knob:
b08_control_index == 0x62 ? (
cc_num = 77;
);
// "MFX" knob:
b08_control_index == 0x5E ? (
cc_num = 78;
);
// "Delay" knob:
b08_control_index == 0x60 ? (
cc_num = 79;
);
// "Reverb" knob:
// TODO. This knob behaves differently than all the other knobs!
cc_num != 0 ? (
midisend(
offset,
cc_status_byte + output_channel,
cc_num,
b09_control_val
);
cc_num = 0;
);
)
) : (
midisend_buf(offset,buf,recvlen); // passthrough other events
)
);