From d36c912e9397fb1965c5faf86f482ab2c955ad5e Mon Sep 17 00:00:00 2001 From: Ralty <78720179+Raltyro@users.noreply.github.com> Date: Sun, 27 Jul 2025 20:17:30 +0700 Subject: [PATCH] FIX AGAIN --- source/funkin/editors/ui/UIAudioPlayer.hx | 2 +- source/lime/_internal/backend/native/NativeAudioSource.hx | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/source/funkin/editors/ui/UIAudioPlayer.hx b/source/funkin/editors/ui/UIAudioPlayer.hx index bd7aaec7..b919f5f4 100644 --- a/source/funkin/editors/ui/UIAudioPlayer.hx +++ b/source/funkin/editors/ui/UIAudioPlayer.hx @@ -31,7 +31,7 @@ class UIAudioPlayer extends UIButton { super(x, y, null, () -> { if (sound.playing) sound.pause(); - else sound.play(); + else sound.play(sound.time + 1 >= sound.length ? 0 : sound.time); }, 58 - 16, 58 - 16); playingSprite = new FlxSprite(x + ((58 - 16)/2) - 8, y + ((58 - 16)/2) - 8).loadGraphic(Paths.image('editors/ui/audio-buttons'), true, 16, 16); diff --git a/source/lime/_internal/backend/native/NativeAudioSource.hx b/source/lime/_internal/backend/native/NativeAudioSource.hx index 4332fba4..2414d990 100644 --- a/source/lime/_internal/backend/native/NativeAudioSource.hx +++ b/source/lime/_internal/backend/native/NativeAudioSource.hx @@ -136,9 +136,9 @@ class NativeAudioSource { public function play() { if (playing || disposed) return; + var t = completed ? 0 : getCurrentTime(); playing = true; - if (completed) setCurrentTime(0); - else setCurrentTime(getCurrentTime()); + setCurrentTime(t); } public function pause() { @@ -394,7 +394,8 @@ class NativeAudioSource { AL.sourcePlay(handle); } } - else completed = value + 1 < getLength(); + else + completed = false; if (!playing && streamed) bufferTimes[STREAM_MAX_BUFFERS - (requestBuffers = queuedBuffers = 1)] = value / 1000;