Fix load and button2 / add reveal callback
authorEugene Petkevich <nasedil.genio.code@gmail.com>
Mon, 30 May 2022 17:58:15 +0000 (20:58 +0300)
committerEugene Petkevich <nasedil.genio.code@gmail.com>
Mon, 30 May 2022 17:58:15 +0000 (20:58 +0300)
extensions/classes/midimix.sc

index 2298c63..5de6ad5 100644 (file)
@@ -5,6 +5,7 @@ MidiMix {
   var <name;
   var <channel = 5;
   var <midiout, <idin;
+  var <>reveal = false;
   // channel selector
   var <>chanrot;
   // modes
@@ -12,7 +13,7 @@ MidiMix {
   // wheel rotation
   var <>jogrot, <>scratch;
   // buttons
-  var <>lpfA, <>lpfB, <>but1, <>but1, <>select, <>sync, <>play, <>cue, <>deck, <>rotbut1, <>rotbut2, <>rotbutload, <>jogact;
+  var <>lpfA, <>lpfB, <>but1, <>but2, <>select, <>sync, <>play, <>cue, <>deck, <>rotbut1, <>rotbut2, <>rotbutload, <>jogact;
   // knobs
   var <>again, <>bgain, <>ahi, <>amid, <>alow, <>bhi, <>bmid, <>blow;
   // faders
@@ -55,8 +56,8 @@ MidiMix {
       8 -> \cue,
       9 -> \deck,
       11 -> \rotbut1,
-      12 -> \rotbut2,
-      13 -> \rotbutload,
+      12 -> \rotbutload,
+      13 -> \rotbut2,
       21 -> \jogact,
     ];
   }
@@ -65,6 +66,12 @@ MidiMix {
     ^super.newCopyArgs(name).prInit;
   }
 
+  noCallback {|handlerName...args|
+    if (reveal) {
+      "%.%(%)".format(this.name, handlerName, args).postln;
+    };
+  }
+
   prInit {
     var dest = MIDIClient.destinations.detect({ |item|
       item.device == "Mix-101"
@@ -188,6 +195,20 @@ MidiMix {
       handler.value(false, *args);
     }, controlNotes.keys.asArray, srcID: idin);
 
+    // initialize handlers with revealing code
+    [
+      \chanrot, \sampler, \loop, \fx, \vinyl, \jogrot, \scratch,
+      \lpfA, \lpfB, \but1, \but2, \select, \sync, \play, \cue, \deck,
+      \rotbut1, \rotbut2, \rotbutload, \jogact,
+      \again, \bgain, \ahi, \amid, \alow, \bhi, \bmid, \blow,
+      \afade, \bfade, \crossfade,
+      \rot1, \rot2, \rotload
+    ].do{|handlerName|
+      this.perform((handlerName++\_).asSymbol, {|...args|
+        this.noCallback(handlerName, *args);
+      });
+    };
+
     // == Starter message and animation
     //this.animate;
     "Шаҫиху готов к использованию 😊".postln;