midi.onControlChange = function(port, data, control, value) {
if (control > 7 && control < 16) return; /* range between sliders and pots */
- if (control >= 32 && control < 40) { /* "S" buttons */
+ if (control >= 32 && control < 40) { /* "S" buttons -> loop */
var nanotouch = $('.nanotouch')[control-32];
if (value == 127) {
var checked = $(nanotouch).find('.loop input').prop('checked');
$(nanotouch).find('.loop input').trigger('change');
}
}
+ if (control >= 48 && control < 55) { /* "M" buttons -> effects */
+ var nanotouch = $('.nanotouch')[control-48];
+ if (value == 127) {
+ var checked = $(nanotouch).find('.effects input').prop('checked');
+ if (checked) {
+ $(nanotouch).find('.effects input').prop('checked', false);
+ device("nanoKONTROL2 MIDI 1").cc(control, 0);
+ } else {
+ $(nanotouch).find('.effects input').prop('checked', true);
+ device("nanoKONTROL2 MIDI 1").cc(control, 127);
+ }
+ $(nanotouch).find('.effects input').trigger('change');
+ }
+
+ }
if (control > 23) return; /* after pots */
if (control < 8) {
control += 8; /* sliders, control bottom pads (8-15) */