mirror of
https://github.com/scratchfoundation/scratch-audio.git
synced 2024-12-22 22:12:48 -05:00
Merge pull request #71 from LLK/bugfix/disconnect-on-dispose
Disconnect audio nodes on dispose
This commit is contained in:
commit
77a1f17b1b
2 changed files with 18 additions and 0 deletions
|
@ -52,6 +52,16 @@ class PanEffect {
|
||||||
connect (node) {
|
connect (node) {
|
||||||
this.channelMerger.connect(node);
|
this.channelMerger.connect(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean up and disconnect audio nodes.
|
||||||
|
*/
|
||||||
|
dispose () {
|
||||||
|
this.input.disconnect();
|
||||||
|
this.leftGain.disconnect();
|
||||||
|
this.rightGain.disconnect();
|
||||||
|
this.channelMerger.disconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = PanEffect;
|
module.exports = PanEffect;
|
||||||
|
|
|
@ -133,6 +133,14 @@ class AudioPlayer {
|
||||||
if (this.audioEngine === null) return;
|
if (this.audioEngine === null) return;
|
||||||
this.effectsNode.gain.setTargetAtTime(value / 100, 0, this.audioEngine.DECAY_TIME);
|
this.effectsNode.gain.setTargetAtTime(value / 100, 0, this.audioEngine.DECAY_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean up and disconnect audio nodes.
|
||||||
|
*/
|
||||||
|
dispose () {
|
||||||
|
this.panEffect.dispose();
|
||||||
|
this.effectsNode.disconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue