Calculate time remaining based on pitch
This commit is contained in:
@@ -424,7 +424,7 @@ class NativeAudioSource
|
||||
timer.stop();
|
||||
}
|
||||
|
||||
var timeRemaining = getLength() - value;
|
||||
var timeRemaining = Std.int((getLength() - getCurrentTime()) / getPitch());
|
||||
|
||||
if (timeRemaining > 0)
|
||||
{
|
||||
@@ -483,7 +483,7 @@ class NativeAudioSource
|
||||
timer.stop();
|
||||
}
|
||||
|
||||
var timeRemaining = value - getCurrentTime();
|
||||
var timeRemaining = Std.int((getLength() - getCurrentTime()) / getPitch());
|
||||
|
||||
if (timeRemaining > 0)
|
||||
{
|
||||
@@ -514,6 +514,22 @@ class NativeAudioSource
|
||||
{
|
||||
AL.sourcef(handle, AL.PITCH, value);
|
||||
|
||||
if (playing)
|
||||
{
|
||||
if (timer != null)
|
||||
{
|
||||
timer.stop();
|
||||
}
|
||||
|
||||
var timeRemaining = Std.int((getLength() - getCurrentTime()) / getPitch());
|
||||
|
||||
if (timeRemaining > 0)
|
||||
{
|
||||
timer = new Timer(timeRemaining);
|
||||
timer.run = timer_onRun;
|
||||
}
|
||||
}
|
||||
|
||||
return getPitch();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user