Simplifying Freeverb dispose

This commit is contained in:
Yotam Mann 2019-12-14 11:53:12 -05:00
parent dedfe18ac2
commit 267f1befc0
3 changed files with 6 additions and 11 deletions

View file

@ -265,6 +265,7 @@ export class TickParam<TypeName extends "hertz" | "bpm"> extends Param<TypeName>
// might be necessary to clear all the previous values
const currentVal = this.value;
this._multiplier = m;
this.value = currentVal;
this.cancelScheduledValues(0);
this.setValueAtTime(currentVal, 0);
}
}

View file

@ -178,7 +178,7 @@ export class Transport extends ToneWithContext<TransportOptions> implements Emit
this._bindClockEvents();
this.bpm = this._clock.frequency as unknown as TickParam<"bpm">;
this._clock.frequency.multiplier = options.ppq;
this.bpm.value = options.bpm;
this.bpm.setValueAtTime(options.bpm, 0);
readOnly(this, "bpm");
this._timeSignature = options.timeSignature;

View file

@ -128,15 +128,9 @@ export class Freeverb extends StereoEffect<FreeverbOptions> {
dispose(): this {
super.dispose();
for (let al = 0; al < this._allpassFiltersL.length; al++) {
this._allpassFiltersL[al].disconnect();
}
for (let ar = 0; ar < this._allpassFiltersR.length; ar++) {
this._allpassFiltersR[ar].disconnect();
}
for (let cf = 0; cf < this._combFilters.length; cf++) {
this._combFilters[cf].dispose();
}
this._allpassFiltersL.forEach(al => al.disconnect());
this._allpassFiltersR.forEach(ar => ar.disconnect());
this._combFilters.forEach(cf => cf.dispose());
this.roomSize.dispose();
return this;
}