mirror of
https://github.com/scratchfoundation/scratch-audio.git
synced 2024-12-22 14:02:29 -05:00
Disconnect audio nodes on dispose
This commit is contained in:
parent
97e099e6de
commit
d2b6cb40e3
2 changed files with 18 additions and 0 deletions
|
@ -52,6 +52,16 @@ class PanEffect {
|
|||
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;
|
||||
|
|
|
@ -133,6 +133,14 @@ class AudioPlayer {
|
|||
if (this.audioEngine === null) return;
|
||||
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