Changed current frame selection
This commit is contained in:
1 parent
aead91d11d
commit
1c2f67fce2
1 file changed
+10
-17
@@ -402,33 +402,26 @@ namespace Vocaluxe.Lib.Video.Acinerella
|
|||||||
private int _FindFrame()
|
private int _FindFrame()
|
||||||
{
|
{
|
||||||
int result = -1;
|
int result = -1;
|
||||||
float diff = 10000000f;
|
float now = _SetTime + _Gap;
|
||||||
|
float maxEnd = now - _FrameDuration * 2; //Get only frames younger than 2
|
||||||
for (int i = 0; i < _FrameBuffer.Length; i++)
|
for (int i = 0; i < _FrameBuffer.Length; i++)
|
||||||
{
|
{
|
||||||
if (_FrameBuffer[i].Displayed)
|
if (_FrameBuffer[i].Displayed)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Time from frame till now (<0 --> Frame is not yet to be shown)
|
float frameEnd = _FrameBuffer[i].Time + _FrameDuration;
|
||||||
float td = _SetTime + _Gap - _FrameBuffer[i].Time;
|
//Don't show frames that are shown during or after now
|
||||||
|
if (frameEnd >= now)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (td > _FrameDuration * 2f)
|
|
||||||
{
|
|
||||||
_FrameBuffer[i].Displayed = true;
|
_FrameBuffer[i].Displayed = true;
|
||||||
_BufferFull = false;
|
_BufferFull = false;
|
||||||
}
|
//Get the last(newest) possible frame and skip the rest to force in-order showing
|
||||||
else if (td < diff && td > _FrameDuration)
|
if (frameEnd <= maxEnd)
|
||||||
{
|
continue;
|
||||||
diff = Math.Abs(td);
|
maxEnd = frameEnd;
|
||||||
result = i;
|
result = i;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (result != -1)
|
|
||||||
{
|
|
||||||
_FrameBuffer[result].Displayed = true;
|
|
||||||
_BufferFull = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user