fix Effect bugs

This commit is contained in:
Michael "Z" Goddard 2018-06-06 14:38:26 -04:00
parent 618239654f
commit 8a75061a19
No known key found for this signature in database
GPG key ID: 762CD40DD5349872
3 changed files with 7 additions and 10 deletions

View file

@ -142,6 +142,7 @@ class AudioPlayer {
* @param {object} target - target whose node to should be connected
*/
connect (target) {
this.outputNode.disconnect();
this.outputNode.connect(target.getInputNode());
}

View file

@ -38,7 +38,7 @@ class Effect {
* @return {boolean} is the effect affecting the graph?
*/
get _isPatch () {
return this.initialized;
return this.initialized && this.value !== this.DEFAULT_VALUE;
}
/**
@ -46,7 +46,7 @@ class Effect {
* @return {AudioNode} - audio node that is the input for this effect
*/
getInputNode () {
if (this.initialized) {
if (this._isPatch) {
return this.inputNode;
}
return this.target.getInputNode();
@ -117,6 +117,10 @@ class Effect {
return;
}
if (this.outputNode !== null) {
this.outputNode.disconnect();
}
let nextTarget = target;
if (this._isPatch) {
nextTarget = this;

View file

@ -20,14 +20,6 @@ class PanEffect extends Effect {
this.channelMerger = null;
}
/**
* Should the effect be connected to the audio graph?
* @return {boolean} is the effect affecting the graph?
*/
get _isPatch () {
return this.initialized && this.value !== 0;
}
/**
* Initialize the Effect.
* Effects start out uninitialized. Then initialize when they are first set