tweek update rate

This commit is contained in:
arc-alex
2025-05-07 11:42:43 +02:00
parent fca54ab793
commit f9f1679e8c
2 changed files with 10 additions and 11 deletions
@@ -716,6 +716,9 @@ function broadcastResult(_target: any, _propertyKey: string, descriptor: Propert
// combine all big changes
const hasImmediateChanges = hasNewLoaded || justStarted || hasChangedPlayback || offsetModeChanged;
// we would like the wall clock to tick on a regular rate
const beutyClockUpdate = getShouldClockUpdate(RuntimeService.previousClockUpdate, state.clock);
/**
* Timer should be updated if
* - big changes
@@ -732,6 +735,7 @@ function broadcastResult(_target: any, _propertyKey: string, descriptor: Propert
/**
* Runtime should be updated if
* - clock tick
* - big changes
* - the timer is updating so runtime also updates to keep them in sync ???
* - notification rate has been exceeded
@@ -739,7 +743,10 @@ function broadcastResult(_target: any, _propertyKey: string, descriptor: Propert
* Then check if there is actually a change in the data
*/
const shouldRuntimeUpdate =
(hasImmediateChanges || shouldUpdateTimer || getForceUpdate(RuntimeService.previousRuntimeUpdate, state.clock)) &&
(beutyClockUpdate ||
hasImmediateChanges ||
shouldUpdateTimer ||
getForceUpdate(RuntimeService.previousRuntimeUpdate, state.clock)) &&
!deepEqual(RuntimeService.previousState?.runtime, state.runtime);
/**
@@ -750,13 +757,9 @@ function broadcastResult(_target: any, _propertyKey: string, descriptor: Propert
/**
* Many other values are calculated based on the clock
* so if any of them are updated we also need to send the clock
* in case nothing else is updating the clock will bw updated at the notification rate
* in case nothing else is updating the clock will be updated at the notification rate
*/
const shouldUpdateClock =
shouldUpdateTimer ||
shouldRuntimeUpdate ||
shouldBlockUpdate ||
getForceUpdate(RuntimeService.previousClockUpdate, state.clock);
const shouldUpdateClock = shouldRuntimeUpdate || shouldBlockUpdate || beutyClockUpdate;
//Now we set all the updates on the eventstore and update the previous value
if (hasChangedPlayback) {
@@ -9,10 +9,6 @@ import { timerConfig } from '../../setup/config.js';
* - we have rolled into a new seconds unit
*/
export function getShouldClockUpdate(previousUpdate: number, now: number): boolean {
const shouldForceUpdate = getForceUpdate(previousUpdate, now);
if (shouldForceUpdate) {
return true;
}
const newSeconds = millisToSeconds(now, TimerType.CountUp) !== millisToSeconds(previousUpdate, TimerType.CountUp);
return newSeconds;
}