summaryrefslogtreecommitdiffhomepage
path: root/main
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-26 02:03:28 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-26 02:03:28 +0200
commita1b8d914bf457dd4508ca37610219ced93303292 (patch)
tree08ea021c92c0e7a70d32cc406c937bea57c87a62 /main
parent12f48dc702f3cb6a1ed8d8e1c51b00154667d372 (diff)
a
Diffstat (limited to 'main')
-rw-r--r--main/main-impl.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/main/main-impl.cpp b/main/main-impl.cpp
index d2ea74cc..1552c980 100644
--- a/main/main-impl.cpp
+++ b/main/main-impl.cpp
@@ -241,20 +241,12 @@ void main_impl::drawEvent()
if (dt_expected.do_sleep)
{
-#ifdef _WIN32
constexpr float eps = 1e-3f;
-#else
- constexpr float eps = 1e-4f;
-#endif
-
const float Δt൦ = timeline.currentFrameDuration(), sleep_secs = dt_expected.value - Δt൦ - dt_expected.jitter;
if (sleep_secs > eps)
- {
- //fm_debug("sleeping for %.1f <- %.1f\n", sleep_secs*1000, dt0*1000);
std::this_thread::sleep_for(std::chrono::nanoseconds((long long)(sleep_secs * 1e9f)));
- }
//fm_debug("jitter:%.1f sleep:%.0f", dt_expected.jitter*1000, sleep_secs*1000);
- const float Δt = (timeline.currentFrameDuration() - dt_expected.value);
+ const float Δt = timeline.currentFrameDuration() - dt_expected.value;
constexpr float α = .1f;
dt_expected.jitter = std::fmax(dt_expected.jitter + Δt * α,
dt_expected.jitter * (1-α) + Δt * α);