Merge worker.js file so this truly has one file, status: tested, not working

This commit is contained in:
msqr1
2024-02-01 17:04:43 -08:00
parent 9d21692993
commit 9f49aa46e0
12 changed files with 466 additions and 238 deletions

View File

@@ -1,26 +1 @@
// A copy and pass processor
registerProcessor("BRProcessor", class extends AudioWorkletProcessor {
constructor(options) {
super(options)
this.done = false
this.port.onmessage = (ev) => {
switch(ev.cmd) {
case "init":
this.recognizerPort = ev.ports[0]
this.wasmMem = new Float32Array(WebAssembly.Memory.buffer).subarray(ev.ptr, ev.ptr+512)
this.channel = ev.channel
break
case "deinit":
this.done = true
}
}
}
process(inputs, outputs, params) {
if(this.done) return false;
this.wasmMem.set(inputs[0].getChannelData(this.channel));
this.recognizerPort.postMessage(".")
outputs = inputs
return true
}
})