From 76d953e90973772b9145210b421dc42aa76e4add Mon Sep 17 00:00:00 2001 From: Joseph Cloutier Date: Wed, 9 Jun 2021 00:58:43 -0400 Subject: [PATCH] Fix `NativeAudioSource.stop()` The `setCurrentTime()` function calls `AL.sourcePlay()` if `playing` is still true, so that should only be called after `playing = false;`. One could also place the call before `AL.sourceStop()`, but that will lead to a few extra function calls. Plus, if `stop()` is supposed to reset the playback time, it should probably do that whether or not the sound is playing (i.e., outside the `if` block). --- src/lime/_internal/backend/native/NativeAudioSource.hx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lime/_internal/backend/native/NativeAudioSource.hx b/src/lime/_internal/backend/native/NativeAudioSource.hx index 0866ed6ee..693625cab 100644 --- a/src/lime/_internal/backend/native/NativeAudioSource.hx +++ b/src/lime/_internal/backend/native/NativeAudioSource.hx @@ -310,7 +310,6 @@ class NativeAudioSource if (playing && handle != null && AL.getSourcei(handle, AL.SOURCE_STATE) == AL.PLAYING) { AL.sourceStop(handle); - setCurrentTime(0); } playing = false; @@ -324,6 +323,8 @@ class NativeAudioSource { timer.stop(); } + + setCurrentTime(0); } // Event Handlers