]> git.0d.be Git - nanofun.git/commitdiff
make pad gain go to absolute zero with no ramping
authorFrédéric Péters <fpeters@0d.be>
Mon, 22 Feb 2021 10:35:34 +0000 (11:35 +0100)
committerFrédéric Péters <fpeters@0d.be>
Mon, 22 Feb 2021 10:35:34 +0000 (11:35 +0100)
nanofun.js

index 7437981bbc6421d77f4ed1259608eb364893ff17..d84962bf5702623050e2d37fdea38d3ee584b245 100644 (file)
@@ -513,7 +513,11 @@ var nanofun = function() {
       var fraction = parseInt(this.value) / parseInt(127);
       var touchIdx = parseInt($(this).parent().data('touch'));
       var now = self.audioCtx.currentTime;
-      self.touchGainNodes[touchIdx].gain.exponentialRampToValueAtTime((fraction * fraction) || 0.0001, now + 0.015);
+      if (fraction == 0) {
+        self.touchGainNodes[touchIdx].gain.value = 0;
+      } else {
+        self.touchGainNodes[touchIdx].gain.exponentialRampToValueAtTime((fraction * fraction) || 0.0001, now + 0.015);
+      }
     });
 
     self.time_interval_id = setInterval(function() {