mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-28 12:33:12 +00:00
Merge pull request #963 from Tonejs/revert-942-buffer-player-timekeeping
Revert "fix for AudioBufferSourceNode stop time miscalculation"
This commit is contained in:
commit
5c15c9517d
1 changed files with 2 additions and 3 deletions
|
@ -168,8 +168,7 @@ export abstract class OneShotSource<
|
||||||
|
|
||||||
// schedule the stop callback
|
// schedule the stop callback
|
||||||
this._stopTime = this.toSeconds(time) + fadeOutTime;
|
this._stopTime = this.toSeconds(time) + fadeOutTime;
|
||||||
const nowTime = this.now();
|
this._stopTime = Math.max(this._stopTime, this.context.currentTime);
|
||||||
this._stopTime = Math.max(this._stopTime, nowTime);
|
|
||||||
if (fadeOutTime > 0) {
|
if (fadeOutTime > 0) {
|
||||||
// start the fade out curve at the given time
|
// start the fade out curve at the given time
|
||||||
if (this._curve === "linear") {
|
if (this._curve === "linear") {
|
||||||
|
@ -189,7 +188,7 @@ export abstract class OneShotSource<
|
||||||
this._curve === "exponential" ? fadeOutTime * 2 : 0;
|
this._curve === "exponential" ? fadeOutTime * 2 : 0;
|
||||||
this._stopSource(this.now() + additionalTail);
|
this._stopSource(this.now() + additionalTail);
|
||||||
this._onended();
|
this._onended();
|
||||||
}, this._stopTime - nowTime);
|
}, this._stopTime - this.context.currentTime);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue