Skip to content

Commit

Permalink
Fix the ConvolverNode issue (#91) (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
skywhale authored and alemangui committed Oct 7, 2018
1 parent c05c441 commit 92f0c9e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Effects/Reverb.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,18 @@ function buildImpulse() {
impulseR[i] = (Math.random() * 2 - 1) * Math.pow(1 - n / length, this.decay);
}

// https://github.com/alemangui/pizzicato/issues/91
// ConvolverNode can be associated with only one buffer.
// Not sure what's the best way, but we are recreating ConvolverNode
// when properties change to work it around.
if (this.reverbNode.buffer) {
this.inputNode.disconnect(this.reverbNode);
this.reverbNode.disconnect(this.wetGainNode);

this.reverbNode = Pizzicato.context.createConvolver();
this.inputNode.connect(this.reverbNode);
this.reverbNode.connect(this.wetGainNode);
}

this.reverbNode.buffer = impulse;
}
}

0 comments on commit 92f0c9e

Please sign in to comment.