Update the player times slightly more often.

This commit is contained in:
Matthew Stratford 2021-01-28 02:35:52 +00:00
parent 05c1d76a75
commit 1a7e062e85
2 changed files with 8 additions and 2 deletions

View file

@ -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,

View file

@ -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<RootState, any>();
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);
});