use the jsNode buffer size instead of the global one

This commit is contained in:
Yotam Mann 2014-03-15 01:25:42 -04:00
parent 9e4075b90e
commit f156f6310a
2 changed files with 5 additions and 5 deletions

View file

@ -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;

View file

@ -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;
}