Add documents and optimize build

This commit is contained in:
msqr1
2024-01-24 20:30:27 -08:00
parent 6da9a662a1
commit e92ddadc99
9 changed files with 139 additions and 44 deletions

23
src/processor.js Normal file
View File

@@ -0,0 +1,23 @@
registerProcessor("wasmMemCpy", class extends AudioWorkletProcessor {
constructor(options) {
super(options)
this.retval = true
this.port.onmessage = (ev) => {
switch(ev.cmd) {
case "init":
this.ptr = ev.ptr
this.wasmMem = ev.wasmMem
this.recognizerPort = ev.ports[0]
break
case "deinit":
this.retval = false
break
}
}
}
process(input, output, param) {
const data = input[0][0]
this.recognizerPort.postMessage("done")
return this.retval
}
})