assassin-bug/framework/resonator/effects/convolver.js

21 lines
951 B
JavaScript

import BaseEffect from './base-effect';
export default class Convolver extends BaseEffect {
constructor(context, graph, params) {
super(context, graph, params);
console.log(`Creating convolver`);
this.effectNode = this.context.getContext().createConvolver();
this.effectNode.buffer = this.effectParams.buffer;
}
connectInput(node) {
this.channelSplitter = this.context.getContext().createChannelSplitter(2);
this.channelMerger = this.context.getContext().createChannelMerger(2);
this.channelSplitter.connect(this.channelMerger, 0, 0);
this.channelSplitter.connect(this.channelMerger, 1, 0);
this.channelSplitter.connect(this.channelMerger, 0, 1);
this.channelSplitter.connect(this.channelMerger, 1, 1);
node.connect(this.channelSplitter);
this.channelMerger.connect(this.effectNode);
this.inputNode = node;
}
}