Skip to content

Commit f302c0d

Browse files
committed
add dispose to panner fallback
1 parent e1a9d07 commit f302c0d

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/oscillator.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ class Oscillator {
446446
this.stop(now);
447447
this.disconnect();
448448
this.panner.dispose();
449+
this.panner = null;
449450
this.oscillator = null;
450451
}
451452
// if it is a Pulse

src/panner.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ if (typeof ac.createStereoPanner !== 'undefined') {
4343
let time = tFromNow || 0;
4444
this.stereoPanner.pan.linearRampToValueAtTime(
4545
val,
46-
this.ac.currentTime + 0.02 + time
46+
this.ac.currentTime + time
4747
);
4848
} else if (typeof val !== 'undefined') {
4949
val.connect(this.stereoPanner.pan);
@@ -157,6 +157,29 @@ if (typeof ac.createStereoPanner !== 'undefined') {
157157
this.output.disconnect();
158158
}
159159
}
160+
161+
dispose() {
162+
if (this.input) {
163+
this.input.disconnect();
164+
delete this.input;
165+
}
166+
if (this.output) {
167+
this.output.disconnect();
168+
delete this.output;
169+
}
170+
if (this.left) {
171+
this.left.disconnect();
172+
delete this.left;
173+
}
174+
if (this.right) {
175+
this.right.disconnect();
176+
delete this.right;
177+
}
178+
if (this.splitter) {
179+
this.splitter.disconnect();
180+
delete this.splitter;
181+
}
182+
}
160183
}
161184
panner = Panner;
162185
}

0 commit comments

Comments
 (0)