]> git.0d.be Git - nanofun.git/blobdiff - nanofun.js
pass 0.01 instead of forbidden 0 to exponentialRampToValueAtTime
[nanofun.git] / nanofun.js
index 0031c52d430058f919b665ab07cd3a56668813f2..fe8102e141aa6129abe5c61fa769daf0e3d4ef6d 100644 (file)
@@ -425,7 +425,7 @@ var nanofun = function() {
     $('#master-gain').on('change', function() {
       var fraction = parseInt(this.value) / parseInt(127);
       var now = self.audioCtx.currentTime;
-      self.masterGainNode.gain.exponentialRampToValueAtTime(fraction * fraction, now + 0.015);
+      self.masterGainNode.gain.exponentialRampToValueAtTime((fraction * fraction) || 0.01, now + 0.015);
     });
 
     $('#delay').on('change', function() {
@@ -434,14 +434,14 @@ var nanofun = function() {
         self.delay.disconnect();
       } else {
         var now = self.audioCtx.currentTime;
-        self.delay.delayTime.exponentialRampToValueAtTime(value, now + 0.015);
+        self.delay.delayTime.exponentialRampToValueAtTime(value || 0.01, now + 0.015);
         self.delay.connect(self.audioCtx.destination);
       }
     });
 
     $('#feedback').on('change', function() {
       var now = self.audioCtx.currentTime;
-      self.feedback.gain.exponentialRampToValueAtTime(this.value, now + 0.015);
+      self.feedback.gain.exponentialRampToValueAtTime(this.value || 0.01, now + 0.015);
     });
 
     $('#filter').on('change', function() {
@@ -452,7 +452,7 @@ 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, now + 0.015);
+      self.touchGainNodes[touchIdx].gain.exponentialRampToValueAtTime((fraction * fraction) || 0.01, now + 0.015);
     });
 
     self.time_interval_id = setInterval(function() {