mirror of
https://github.com/scratchfoundation/scratch-audio.git
synced 2024-12-22 05:53:43 -05:00
fix Effect bugs
This commit is contained in:
parent
618239654f
commit
8a75061a19
3 changed files with 7 additions and 10 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue