Nothing is working but it is on the right track! ASYNCIFY removed, manual waiting instead and some proxying logic

This commit is contained in:
msqr1
2024-01-28 00:09:16 -08:00
parent efb56e19f9
commit 8796f35445
22 changed files with 239 additions and 7375 deletions

28
src/processor.js Normal file
View File

@@ -0,0 +1,28 @@
// A copy and pass processor, check if already registered
if(typeof BRProcessor === "undefined") {
var 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)
break
case "deinit":
this.done = true
break
}
}
}
process(inputs, outputs, params) {
if(this.done) return false;
inputs[0].copyFromChannel(this.wasmMem, this.channel)
this.recognizerPort.postMessage(".") // Basically an empty message
outputs = inputs
return true
}
}
registerProcessor("BRProcessor", BRProcessor)
}