From 6f165b5e88ecb8d4b190ef9d688fc74c91106250 Mon Sep 17 00:00:00 2001 From: EvolvedGhost <727511070@qq.com> Date: Sat, 17 Oct 2026 23:42:07 +0800 Subject: [PATCH] fix(audio): preserve in-progress pause fade on stop --- src/audio/player.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/audio/player.ts b/src/audio/player.ts index 3c26baa..c7d29ba 100644 --- a/src/audio/player.ts +++ b/src/audio/player.ts @@ -596,14 +596,18 @@ export class AudioPlayer extends EventEmitter { } stopWithFade(): void { - if (this.state !== "playing" || this.externalMode) { + if (this.externalMode || this.state === "idle") { this.stop(); return; } this.stopAfterPauseTail = true; - this.pauseFrames = 9; - this.setTransportRamp(0, 0, 5); - this.state = "paused"; + if (this.state === "playing") { + this.pauseFrames = 9; + this.setTransportRamp(0, 0, 5); + this.state = "paused"; + } else if (this.pauseFrames === 0) { + this.stop(); + } } stop(keepAlive = false): void {