Created
June 28, 2019 13:09
-
-
Save cho45/0808821469a8a84c2231dd54eac67798 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SignalProcessor extends AudioWorkletProcessor { | |
constructor() { | |
super(); | |
this.buffers = []; | |
this.port.onmessage = (e) => { | |
console.log(e, this.buffers); | |
this.port.postMessage(this.buffers); | |
// this.buffers.length = 0; | |
}; | |
} | |
process(inputs, outputs, parameters) { | |
this.buffers.push(inputs); | |
return true; | |
} | |
} | |
registerProcessor('signal-processor', SignalProcessor); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment