mirror of
https://github.com/scratchfoundation/scratch-audio.git
synced 2024-12-22 14:02:29 -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) {
|
||||
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