26 , motherBoard(motherBoard_)
27 , eventDistributor(motherBoard.getReactor().getEventDistributor())
28 , eventDelay(eventDelay_)
29 , throttleManager(globalSettings.getThrottleManager())
30 , speedSetting (globalSettings.getSpeedSetting())
31 , pauseSetting (globalSettings.getPauseSetting())
32 , powerSetting (globalSettings.getPowerSetting())
36 speedSetting.
attach(*
this);
37 throttleManager.
attach(*
this);
38 pauseSetting.
attach(*
this);
39 powerSetting.
attach(*
this);
52 powerSetting.
detach(*
this);
53 pauseSetting.
detach(*
this);
54 throttleManager.
detach(*
this);
55 speedSetting.
detach(*
this);
60 return (time2 - time1).toDouble() * 100.0 / speedSetting.
getValue();
70 auto realDuration =
static_cast<uint64_t
>(
73 return (currentRealTime + us) <
82 internalSync(time, allowSleep);
91 auto realDuration =
static_cast<uint64_t
>(
93 idealRealTime += realDuration;
95 int64_t
sleep = idealRealTime - currentRealTime;
98 sleep +=
static_cast<int64_t
>(sleepAdjust);
105 delta = sleep - slept;
107 const double ALPHA = 0.2;
108 sleepAdjust = sleepAdjust * (1 - ALPHA) + delta * ALPHA;
112 idealRealTime = currentRealTime -
MAX_LAG / 2;
116 eventDelay.
sync(time);
124 internalSync(time,
true);
128 int RealTime::signalEvent(
const std::shared_ptr<const Event>& event)
130 if (!motherBoard.
isActive() || !enabled) {
136 auto& ffe = checked_cast<
const FinishFrameEvent&>(*event);
137 if (!ffe.needRender()) {
148 void RealTime::update(
const Setting& )
153 void RealTime::update(
const ThrottleManager& )
160 if (!enabled)
return;