feat(audio): new-leader call in practice can be turned off (1.89.10)

This commit is contained in:
larssand committed 2026-11-12 21:37:38 +01:00
1 parent daed2ff790
commit 755844c22d
10 files changed
+30 -5

No files matched your search

+3
View File
@@ -107,6 +107,8 @@ export function normalizeRaceAudioSettings(value = {}) {
// Qualifying and finals: "both" = when the leader changes and every 2 minutes,
// "change" = only when the leader changes, "off" = never (unless raceCallouts is "full").
raceLeaderCalls: ["off", "change", "both"].includes(source.raceLeaderCalls) ? source.raceLeaderCalls : "both",
// Practice: "new leader" is fun info for many, but nobody races anyone - it can be turned off.
practiceLeaderCalls: source.practiceLeaderCalls === "off" ? "off" : "on",
// Open Practice personal best calls (practice_callouts_logic.js); 0 turns a rule off.
practicePbWarmupLaps: Math.round(clamp(source.practicePbWarmupLaps, 10, 0, 30)),
practicePbCooldownSec: Math.round(clamp(source.practicePbCooldownSec, 60, 0, 600)),
@@ -131,6 +133,7 @@ export function isSilencedDuringRace(eventKey, settings, session) {
const practice = Boolean(session) && PRACTICE_TYPES.has(String(session.type || ""));
if (PRACTICE_HYPE_SET.has(eventKey)) return !practice || !audio.practiceHype;
if (eventKey === "lap_completed") return audio.lapTimeCalls === "off" || (audio.lapTimeCalls === "practice" && !practice);
if (practice && eventKey === "new_leader") return audio.practiceLeaderCalls === "off";
if (!session || practice) return false;
if (eventKey === "leader_update") return audio.raceLeaderCalls !== "both";
if (eventKey === "new_leader" && audio.raceLeaderCalls !== "off") return false;