From f156f6310a8fdc1ec5d0bccce49f736028fdb80a Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Sat, 15 Mar 2014 01:25:42 -0400 Subject: [PATCH] use the jsNode buffer size instead of the global one --- src/components/Meter.js | 2 +- src/components/Noise.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/Meter.js b/src/components/Meter.js index 7527cc33..32ffa4a1 100644 --- a/src/components/Meter.js +++ b/src/components/Meter.js @@ -59,7 +59,7 @@ AudioUnit.Meter.prototype.isClipped = function(){ //get the max value AudioUnit.Meter.prototype.onprocess = function(event){ - var bufferSize = this.bufferSize; + var bufferSize = this.jsNode.bufferSize; for (var channel = 0; channel < this.channels; channel++){ var input = event.inputBuffer.getChannelData(channel); var sum = 0; diff --git a/src/components/Noise.js b/src/components/Noise.js index 9e8edaaa..c7faa9e8 100644 --- a/src/components/Noise.js +++ b/src/components/Noise.js @@ -44,7 +44,7 @@ AudioUnit.Noise.prototype._pinkNoise = (function() { var b0, b1, b2, b3, b4, b5, b6; b0 = b1 = b2 = b3 = b4 = b5 = b6 = 0.0; return function(e) { - var bufferSize = this.bufferSize; + var bufferSize = this.jsNode.bufferSize; var output = e.outputBuffer.getChannelData(0); for (var i = 0; i < bufferSize; i++) { var white = Math.random() * 2 - 1; @@ -65,7 +65,7 @@ AudioUnit.Noise.prototype._pinkNoise = (function() { AudioUnit.Noise.prototype._brownNoise = (function() { var lastOut = 0.0; return function(e) { - var bufferSize = this.bufferSize; + var bufferSize = this.jsNode.bufferSize; var output = e.outputBuffer.getChannelData(0); for (var i = 0; i < bufferSize; i++) { var white = Math.random() * 2 - 1; @@ -79,8 +79,8 @@ AudioUnit.Noise.prototype._brownNoise = (function() { //modified from http://noisehack.com/generate-noise-web-audio-api/ AudioUnit.Noise.prototype._whiteNoise = function(e){ - var bufferSize = this.bufferSize; - var output = e.outputBuffer.getChannelData(0); + var bufferSize = this.jsNode.bufferSize; + var output = e.outputBuffer.getChannelData(0); for (var i = 0; i < bufferSize; i++) { output[i] = Math.random() * 2 - 1; }