implementing

This commit is contained in:
Jade (Rose) Rowland 2024-05-03 14:58:20 -04:00
parent 496d60dc1c
commit 66a27a609c

View file

@ -106,23 +106,21 @@ class GainModProcessor extends AudioWorkletProcessor {
} }
process(inputs, outputs, parameters) { process(inputs, outputs, parameters) {
const input = inputs[0]; // const input = inputs[0];
const output = outputs[0]; // const output = outputs[0];
const blockSize = 128; // const blockSize = 128;
// let crush = parameters.crush[0] ?? 8;
let crush = parameters.crush[0] ?? 8; // crush = Math.max(1, crush);
crush = Math.max(1, crush); // if (input[0] == null || output[0] == null) {
// return false;
if (input[0] == null || output[0] == null) { // }
return false; // for (let n = 0; n < blockSize; n++) {
} // for (let i = 0; i < input.length; i++) {
for (let n = 0; n < blockSize; n++) { // const x = Math.pow(2, crush - 1);
for (let i = 0; i < input.length; i++) { // output[i][n] = Math.round(input[i][n] * x) / x;
const x = Math.pow(2, crush - 1); // }
output[i][n] = Math.round(input[i][n] * x) / x; // }
} // return true;
}
return true;
} }
} }
registerProcessor('gainmod-processor', GainModProcessor); registerProcessor('gainmod-processor', GainModProcessor);