]> git.0d.be Git - nanofun.git/commitdiff
add control of effects via M buttons
authorFrédéric Péters <fpeters@0d.be>
Wed, 20 Jan 2021 08:49:29 +0000 (09:49 +0100)
committerFrédéric Péters <fpeters@0d.be>
Wed, 20 Jan 2021 08:49:48 +0000 (09:49 +0100)
(and invert loop & effects display order to match the physical layout)

nanofun.css
nanofun.js

index 74227654a0a3cd90c1329f3b525282aa9427a24b..ffe01e0e24f0602a2dd0baba6b043c2c83f63abd 100644 (file)
@@ -62,14 +62,14 @@ div.nanotouch input[type=range] {
 div.nanotouch .effects {
   position: absolute;
   left: 0;
-  bottom: 5ex;
+  bottom: 2ex;
   z-index: 10000;
 }
 
 div.nanotouch .loop {
   position: absolute;
   left: 0;
-  bottom: 2ex;
+  bottom: 5ex;
   z-index: 10000;
 }
 
index fe8102e141aa6129abe5c61fa769daf0e3d4ef6d..13813a124f7b979bedd07e4dac9d7eb19cd94f5b 100644 (file)
@@ -375,7 +375,7 @@ var nanofun = function() {
 
     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');
@@ -389,6 +389,21 @@ var nanofun = function() {
             $(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) */