From 1a7e062e859909856ee05f1fe1bb2ced4769d5e8 Mon Sep 17 00:00:00 2001 From: Matthew Stratford Date: Thu, 28 Jan 2021 02:35:52 +0000 Subject: [PATCH] Update the player times slightly more often. --- src/mixer/state.ts | 6 +++++- src/showplanner/Player.tsx | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mixer/state.ts b/src/mixer/state.ts index 5da6880..d05aa38 100644 --- a/src/mixer/state.ts +++ b/src/mixer/state.ts @@ -28,6 +28,7 @@ import { BED_LEVEL_DB, FULL_LEVEL_DB, } from "./audio"; +import { PLAYER_COUNTER_UPDATE_PERIOD_MS } from "../showplanner/Player"; const playerGainTweens: Array<{ target: VolumePresetEnum; @@ -539,7 +540,10 @@ export const load = ( ); }); playerInstance.on("timeChange", (time) => { - if (Math.abs(time - getState().mixer.players[player].timeCurrent) > 0.5) { + if ( + Math.abs(time - getState().mixer.players[player].timeCurrent) > + PLAYER_COUNTER_UPDATE_PERIOD_MS / 1000 + ) { dispatch( mixerState.actions.setTimeCurrent({ player, diff --git a/src/showplanner/Player.tsx b/src/showplanner/Player.tsx index 1e4f565..27c4839 100644 --- a/src/showplanner/Player.tsx +++ b/src/showplanner/Player.tsx @@ -22,6 +22,8 @@ import { INTERNAL_OUTPUT_ID } from "../mixer/audio"; export const USE_REAL_GAIN_VALUE = false; +export const PLAYER_COUNTER_UPDATE_PERIOD_MS = 200; + function PlayerNumbers({ id, pfl }: { id: number; pfl: boolean }) { const store = useStore(); const [ @@ -40,7 +42,7 @@ function PlayerNumbers({ id, pfl }: { id: number; pfl: boolean }) { state.timeRemaining, now.valueOf() / 1000 + state.timeRemaining, ]); - }, 1000); + }, PLAYER_COUNTER_UPDATE_PERIOD_MS); return () => window.clearInterval(tickerRef.current); });