You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Every single browser (Firefox, Edge, Safari tested) throws a TypeError when attempting to connect to a polyfilled AudioWorkletNode, and I believe it's caused by these lines:
window.AudioWorkletNode = function AudioWorkletNode (context, name) {
const processor = getProcessorsForContext(context)[name];
this.parameters = new Map();
if (processor.properties) {
for (let i = 0; i < processor.properties.length; i++) {
const prop = processor.properties[i];
const node = context.createGain().gain;
node.value = prop.defaultValue;
// @TODO there's no good way to construct the proxy AudioParam here
this.parameters.set(prop.name, node);
}
}
const inst = new processor.Processor({});
this.port = processor.port;
const scriptProcessor = context.createScriptProcessor();
scriptProcessor.node = this;
scriptProcessor.processor = processor;
scriptProcessor.instance = inst;
scriptProcessor.onaudioprocess = onAudioProcess;
Object.defineProperty(this, '$$node', { value: scriptProcessor });
};
Here, a custom class instance is constructed, but that's not accepted by any browser as the first argument to AudioNode.connect. A true, real, native AudioNode object is required for that to work, and this cannot be faked with setting the prototype manually.
The correct course of action would be returning an augmented ScriptProcessorNode.
The text was updated successfully, but these errors were encountered:
JohnWeisz
changed the title
Doesn't work in any browser
Doesn't work as an argument to 'AudioNode.connect'
Aug 26, 2018
Every single browser (Firefox, Edge, Safari tested) throws a TypeError when attempting to connect to a polyfilled
AudioWorkletNode
, and I believe it's caused by these lines:Here, a custom class instance is constructed, but that's not accepted by any browser as the first argument to
AudioNode.connect
. A true, real, nativeAudioNode
object is required for that to work, and this cannot be faked with setting the prototype manually.The correct course of action would be returning an augmented
ScriptProcessorNode
.The text was updated successfully, but these errors were encountered: