public void Tick() { timecodeDecoder.ParseAudioData(deviceSelector.AudioDataSpan); currentTimecode = timecodeDecoder.LastTimecode; if (lastTimecode != currentTimecode) { var lastFrameDifference = Mathf.Abs(currentTimecode.ToFrame(30) - lastTimecode.ToFrame(30)); var lastTwoFrameDifference = Mathf.Abs(lastTimecode.ToFrame(30) - lastTwoTimecode.ToFrame(30)); var effectiveDifference = Mathf.Abs(currentTimecode.ToFrame(30) - lastEffectiveTimecode.ToFrame(30)); if (lastFrameDifference + lastTwoFrameDifference == 2 || effectiveDifference <= 5) { onTimecodeUpdatedSubject.OnNext(currentTimecode); lastEffectiveTimecode = currentTimecode; } else { // Debug.Log($"Frame skipped : {currentTimecode} - Last Effective : {lastEffectiveTimecode}"); } lastTwoTimecode = lastTimecode; lastTimecode = currentTimecode; } }