Add optional dict argument to bind
authorEugene Petkevich <nasedil.genio.code@gmail.com>
Tue, 7 Jun 2022 16:50:43 +0000 (19:50 +0300)
committerEugene Petkevich <nasedil.genio.code@gmail.com>
Tue, 7 Jun 2022 16:50:43 +0000 (19:50 +0300)
extensions/classes/midibind.sc

index 159ee85..ec82b63 100644 (file)
@@ -3,8 +3,8 @@
     {|d|
       this.get(param, { |v|
         var newVal = v*((d)/divisor).midiratio;
-        "%: % = %\n".postf(this, param, newVal);
         this.set(param, newVal);
+        "%: % = %\n".postf(this, param, newVal);
       });
     }
   }
@@ -13,8 +13,8 @@
     {|d|
       this.get(param, { |v|
         var newVal = v+(d/divisor);
-        "%: % = %\n".postf(this, param, newVal);
         this.set(param, newVal);
+        "%: % = %\n".postf(this, param, newVal);
       });
     }
   }
   bindRange {|param, start, end|
     {|v|
       var newVal = v.linlin(0, 1, start, end);
-      "%: % = %\n".postf(this, param, newVal);
       this.set(param, newVal);
+      "%: % = %\n".postf(this, param, newVal);
     }
   }
 
-  bindWarp {|param, warp=(\lin.asWarp)|
+  bindWarp {|param, warp=(\lin.asWarp), dict=nil|
     warp = warp.asWarp;
     {|v|
       var newVal = warp.map(v);
-      "%: % = %\n".postf(this, param, newVal);
       this.set(param, newVal);
+      "%: % = %\n".postf(this, param, newVal);
+      dict !? {dict[param] = newVal;};
     }
   }
+
 }
\ No newline at end of file