From e1c66311dbbd835ae7b2b5fb364daf01e5169de3 Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Fri, 15 Oct 2021 15:39:44 -0400 Subject: [PATCH] Revert "fix for AudioBufferSourceNode stop time miscalculation" --- Tone/source/OneShotSource.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Tone/source/OneShotSource.ts b/Tone/source/OneShotSource.ts index 4b97dfc1..e28ce388 100644 --- a/Tone/source/OneShotSource.ts +++ b/Tone/source/OneShotSource.ts @@ -168,8 +168,7 @@ export abstract class OneShotSource< // schedule the stop callback this._stopTime = this.toSeconds(time) + fadeOutTime; - const nowTime = this.now(); - this._stopTime = Math.max(this._stopTime, nowTime); + this._stopTime = Math.max(this._stopTime, this.context.currentTime); if (fadeOutTime > 0) { // start the fade out curve at the given time if (this._curve === "linear") { @@ -189,7 +188,7 @@ export abstract class OneShotSource< this._curve === "exponential" ? fadeOutTime * 2 : 0; this._stopSource(this.now() + additionalTail); this._onended(); - }, this._stopTime - nowTime); + }, this._stopTime - this.context.currentTime); return this; }