跳到主要内容

parameters

2024年02月06日
柏拉文
越努力,越幸运

一、认识


二、语法


xxxProcessor.js
class XxxProcessor extends AudioWorkletProcessor {
constructor(...args) {
super(...args);
this.port.onmessage = (e) => {
console.log(e.data);
this.port.postMessage("pong");
};
}
process(inputs, outputs, parameters) {
return true;
}
}

registerProcessor("xxx-processor", XxxProcessor);
const audioContext = new AudioContext();
await audioContext.audioWorklet.addModule('xxxProcessor.js');
const audioWorkletNode = new AudioWorkletNode(audioContext, 'xxx-processor', options);
audioContext.context(audioWorkletNode).context(audioContext.destination);

console.log("audioWorkletNode.parameters",audioWorkletNode.parameters);