mirror of
https://github.com/scratchfoundation/scratch-audio.git
synced 2024-12-22 22:12:48 -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
|
* @param {object} target - target whose node to should be connected
|
||||||
*/
|
*/
|
||||||
connect (target) {
|
connect (target) {
|
||||||
|
this.outputNode.disconnect();
|
||||||
this.outputNode.connect(target.getInputNode());
|
this.outputNode.connect(target.getInputNode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ class Effect {
|
||||||
* @return {boolean} is the effect affecting the graph?
|
* @return {boolean} is the effect affecting the graph?
|
||||||
*/
|
*/
|
||||||
get _isPatch () {
|
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
|
* @return {AudioNode} - audio node that is the input for this effect
|
||||||
*/
|
*/
|
||||||
getInputNode () {
|
getInputNode () {
|
||||||
if (this.initialized) {
|
if (this._isPatch) {
|
||||||
return this.inputNode;
|
return this.inputNode;
|
||||||
}
|
}
|
||||||
return this.target.getInputNode();
|
return this.target.getInputNode();
|
||||||
|
@ -117,6 +117,10 @@ class Effect {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.outputNode !== null) {
|
||||||
|
this.outputNode.disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
let nextTarget = target;
|
let nextTarget = target;
|
||||||
if (this._isPatch) {
|
if (this._isPatch) {
|
||||||
nextTarget = this;
|
nextTarget = this;
|
||||||
|
|
|
@ -20,14 +20,6 @@ class PanEffect extends Effect {
|
||||||
this.channelMerger = null;
|
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.
|
* Initialize the Effect.
|
||||||
* Effects start out uninitialized. Then initialize when they are first set
|
* Effects start out uninitialized. Then initialize when they are first set
|
||||||
|
|
Loading…
Reference in a new issue