- From: Peter van der Noord <peterdunord@gmail.com>
- Date: Sun, 22 Jul 2012 13:33:42 +0200
- To: public-audio@w3.org
Yay, I just made my first jsnode! When writing the event-callback.... onAudioProcess: function(event) { var inputArray = event.inputBuffer.getChannelData(0); var outputArray = event.outputBuffer.getChannelData(0); for(var i = 0; i < outputArray.length; i++) { outputArray[i] = // write stuff } } ... i wondered: what exactly do the getChannelData() methods do, or to be more precise: what does the implementation do? Looking at the behavior of nodes when they don't have outgoing connections (they don't run in that case), i assume that one method requests a buffer from whatever output is connected to its input, possibly creating/copying/passing large buffers around. Aren't those two methods rather heavy? I know they're not in the main bufferwriting loop, but they still get hit quite a few times, and my thought would be to remove as many functioncalls as possible from onAudioProcess (and especially from the for-loop, obviously). Peter
Received on Sunday, 22 July 2012 11:34:09 UTC