mirror of
https://github.com/Tonejs/Tone.js
synced 2025-01-14 04:43:54 +00:00
the putback
This commit is contained in:
parent
5c15c9517d
commit
6decb02d9a
1 changed files with 3 additions and 2 deletions
|
@ -168,7 +168,8 @@ export abstract class OneShotSource<
|
|||
|
||||
// schedule the stop callback
|
||||
this._stopTime = this.toSeconds(time) + fadeOutTime;
|
||||
this._stopTime = Math.max(this._stopTime, this.context.currentTime);
|
||||
const nowTime = this.now();
|
||||
this._stopTime = Math.max(this._stopTime, nowTime);
|
||||
if (fadeOutTime > 0) {
|
||||
// start the fade out curve at the given time
|
||||
if (this._curve === "linear") {
|
||||
|
@ -188,7 +189,7 @@ export abstract class OneShotSource<
|
|||
this._curve === "exponential" ? fadeOutTime * 2 : 0;
|
||||
this._stopSource(this.now() + additionalTail);
|
||||
this._onended();
|
||||
}, this._stopTime - this.context.currentTime);
|
||||
}, this._stopTime - nowTime);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue