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).
This commit is contained in:
Joseph Cloutier
2021-06-09 00:58:43 -04:00
committed by Joshua Granick
parent 195b1dbaef
commit 76d953e909

View File

@@ -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