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:
committed by
Joshua Granick
parent
195b1dbaef
commit
76d953e909
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user