feat(audio): practice hype calls and leader calls in qualifying and finals (1.61.0)
This commit is contained in:
1 parent
f602778895
commit
94ec278f53
13 files changed
+334
-9
No files matched your search
+12
@@ -2531,6 +2531,12 @@ const TRANSLATIONS = {
|
||||
"audio.practice_pb_warmup": "Träning: tyst personbästa första varven",
|
||||
"audio.practice_pb_cooldown": "Träning: sekunder mellan PB-utrop per förare",
|
||||
"audio.practice_pb_min_gain": "Träning: minsta förbättring för utrop (s)",
|
||||
"audio.practice_hype": "Peppande träningsutrop",
|
||||
"audio.practice_hype_hint": "Bara i träning, aldrig i kval eller final: varvjubileum, nära bästa varvet, snittet går ner, snabbare varv i rad, snabbare än förra gången, placering i klassen och dueller. Varje utrop kan också stängas av i listan nedan.",
|
||||
"audio.race_leader_calls": "Ledare i kval och final",
|
||||
"audio.race_leader_both": "Vid byte och var 2:a minut",
|
||||
"audio.race_leader_change": "Bara när ledaren byts",
|
||||
"audio.race_leader_off": "Av",
|
||||
"audio.practice_pb_hint": "Gäller open practice. På nyladdade ackar slår alla sin bästa tid nästan varje varv i början av dagen. Bästa varvet visas ändå på skärm och overlay. 0 stänger av regeln.",
|
||||
"audio.race_callouts_passing": "Bara passeringsljud (som tidtagningssystem)",
|
||||
"audio.race_callouts_full": "Speaker - namn, bästa varv, ny ledare",
|
||||
@@ -4512,6 +4518,12 @@ const TRANSLATIONS = {
|
||||
"audio.practice_pb_warmup": "Practice: silent personal best for first laps",
|
||||
"audio.practice_pb_cooldown": "Practice: seconds between PB calls per driver",
|
||||
"audio.practice_pb_min_gain": "Practice: minimum improvement to call (s)",
|
||||
"audio.practice_hype": "Practice hype calls",
|
||||
"audio.practice_hype_hint": "Practice only, never in qualifying or finals: lap milestones, close to best, average going down, faster laps in a row, faster than last time, class rank and duels. Each call can also be turned off in the list below.",
|
||||
"audio.race_leader_calls": "Leader in qualifying and finals",
|
||||
"audio.race_leader_both": "On change and every 2 minutes",
|
||||
"audio.race_leader_change": "Only when the leader changes",
|
||||
"audio.race_leader_off": "Off",
|
||||
"audio.practice_pb_hint": "Open Practice. On fresh packs everyone beats their best almost every lap early in the day. The best lap is still shown on screen and in the overlay. 0 turns a rule off.",
|
||||
"audio.race_callouts_passing": "Passing tone only (like timing systems)",
|
||||
"audio.race_callouts_full": "Speaker - names, best laps, new leader",
|
||||
|
||||
+60
-2
@@ -3,13 +3,52 @@ import { getControlledLapStreak } from "./training_logic.js";
|
||||
import { usesPersonalClock, getLatestClockStartTs } from "./prologue_logic.js";
|
||||
import { isSuspectLap, getSuspectReferenceLaps, releaseSettledSuspectLaps } from "./suspect_laps_logic.js";
|
||||
import { shouldCallPracticePersonalBest } from "./practice_callouts_logic.js";
|
||||
import { normalizeRaceAudioSettings, formatSpokenLapTime } from "./race_audio.js";
|
||||
import { normalizeRaceAudioSettings, formatSpokenLapTime, LEADER_UPDATE_INTERVAL_MS } from "./race_audio.js";
|
||||
import { pickPracticeHype, getDriverLapTimes, getClassRank, getLastTimeBestMs, findDuelRival } from "./practice_hype_logic.js";
|
||||
import { decoderClockCheck, describeDecoderClockSkew } from "./decoder_clock_check.js";
|
||||
import { getCompetitorEndTs } from "./timing_logic.js";
|
||||
|
||||
const PRACTICE_SESSION_TYPES = new Set(["open_practice", "free_practice", "practice"]);
|
||||
// Last personal best *called* per driver, per practice day and layout (practice_callouts_logic.js).
|
||||
const lastPracticePbCall = new Map();
|
||||
const practiceHypeMemory = new Map();
|
||||
const lastLeaderCallBySession = new Map();
|
||||
const spokenName = (row) => row?.speechName || row?.displayName || row?.driverName || "";
|
||||
|
||||
// Practice hype (practice_hype_logic.js): gathers this lap's numbers and returns at most one
|
||||
// call with its spoken variables, or null.
|
||||
function buildPracticeHype({ state, session, result, entry, key, lapMs, previousPersonalBest, memoryKey, timestamp }) {
|
||||
const memory = practiceHypeMemory.get(memoryKey) || {};
|
||||
practiceHypeMemory.set(memoryKey, memory);
|
||||
const rows = Object.values(result.competitors || {});
|
||||
const classId = state.drivers?.find((driver) => driver.id === entry.driverId)?.classId || "";
|
||||
const classRows = classId ? rows.filter((row) => state.drivers.find((driver) => driver.id === row.driverId)?.classId === classId) : [];
|
||||
const after = getClassRank(classRows, key);
|
||||
const before = getClassRank(classRows.map((row) => (row.key === key ? { ...row, bestLapMs: previousPersonalBest } : row)), key);
|
||||
const isPb = Boolean(previousPersonalBest && lapMs < previousPersonalBest);
|
||||
if (isPb && !memory.beatLastTime && memory.lastTimeBestMs === undefined) {
|
||||
const dayStartTs = new Date(timestamp).setHours(0, 0, 0, 0);
|
||||
const lists = (state.sessions || []).map((item) => state.resultsBySession?.[item.id]?.passings);
|
||||
memory.lastTimeBestMs = getLastTimeBestMs(lists, { driverId: entry.driverId, layoutId: session.trackLayoutId, dayStartTs });
|
||||
}
|
||||
const rival = isPb ? findDuelRival(rows, { key, bestLapMs: lapMs, now: timestamp }) : null;
|
||||
const pick = pickPracticeHype({
|
||||
laps: getDriverLapTimes(result.passings, key), lapMs, previousBestMs: previousPersonalBest, lapCount: entry.laps,
|
||||
classRankBefore: before.rank, classRankAfter: after.rank, classSize: after.size,
|
||||
lastTimeBestMs: memory.lastTimeBestMs, rival: rival ? { gapMs: rival.gapMs, name: spokenName(rival) } : null,
|
||||
now: Date.now(), memory,
|
||||
});
|
||||
if (!pick) return null;
|
||||
const language = normalizeRaceAudioSettings(state.settings?.raceAudio).language;
|
||||
const en = language === "en";
|
||||
const v = pick.variables;
|
||||
const variables = { driverName: spokenName(entry), laps: v.laps, rival: v.rival };
|
||||
if (v.gapMs !== undefined) variables.gap = formatSpokenLapTime(Math.max(10, v.gapMs), language);
|
||||
if (v.avgMs) variables.avgLap = formatSpokenLapTime(v.avgMs, language);
|
||||
if (v.rank) variables.rank = (en ? ["the fastest", "second fastest", "third fastest"] : ["snabbast", "näst snabbast", "tredje snabbast"])[v.rank - 1];
|
||||
if (v.ahead !== undefined) variables.relation = v.ahead ? (en ? "ahead of" : "före") : (en ? "behind" : "efter");
|
||||
return { key: pick.key, variables };
|
||||
}
|
||||
|
||||
function getCurrentPracticePaceLaps(result, competitorKey) {
|
||||
const laps = [];
|
||||
@@ -603,13 +642,32 @@ export function processDecoderMessageHelper(msg, deps, decoderRole = "main") {
|
||||
if (callPersonalBest) triggerRaceAudio("personal_best", { variables: audioVariables, driverId: entry.driverId, competitorKey: key, logData: { raceId: session.eventId, driverId: entry.driverId, lapNumber: entry.laps, lapTime: lapMs } });
|
||||
if (!suspect && previousSessionFastest && lapMs < previousSessionFastest) triggerRaceAudio("fastest_lap", { variables: audioVariables, driverId: entry.driverId, competitorKey: key, logData: { raceId: session.eventId, driverId: entry.driverId, lapNumber: entry.laps, lapTime: lapMs } });
|
||||
if (!suspect && previousTrackRecord && lapMs < previousTrackRecord) triggerRaceAudio("track_record", { variables: audioVariables, driverId: entry.driverId, competitorKey: key, logData: { raceId: session.eventId, driverId: entry.driverId, lapNumber: entry.laps, lapTime: lapMs } });
|
||||
if (isPracticeSession && entry.driverId && !suspect && !validationWarning) {
|
||||
const hype = buildPracticeHype({ state, session, result, entry, key, lapMs, previousPersonalBest, memoryKey: pbCallKey, timestamp });
|
||||
if (hype) triggerRaceAudio(hype.key, { variables: hype.variables, driverId: entry.driverId, competitorKey: key, logData: { raceId: session.eventId, sessionId: session.id, driverId: entry.driverId, lapNumber: entry.laps, lapTime: lapMs } });
|
||||
}
|
||||
if (previousPosition >= 0 && currentPosition >= 0 && currentPosition < previousPosition) triggerRaceAudio("position_gain", { driverId: entry.driverId, competitorKey: key });
|
||||
if (previousPosition >= 0 && currentPosition > previousPosition) triggerRaceAudio("position_loss", { driverId: entry.driverId, competitorKey: key });
|
||||
const leader = leaderboard[0];
|
||||
if (leader?.key && lastOverlayLeaderKeyBySession[session.id] !== leader.key) {
|
||||
lastOverlayLeaderKeyBySession[session.id] = leader.key;
|
||||
pushOverlayEvent("leader", `${leader.displayName || leader.driverName} • P1`);
|
||||
if (previousLeaderKey && previousLeaderKey !== leader.key) triggerRaceAudio("new_leader", { variables: { driverName: leader.displayName || leader.driverName }, driverId: leader.driverId, competitorKey: leader.key, logData: { raceId: session.eventId, driverId: leader.driverId } });
|
||||
// Qualifying and finals: no leader calls in the first 30 s (everyone swaps places on the
|
||||
// first lap) and at most one every 10 s.
|
||||
const settled = isPracticeSession || Date.now() - Number(session.startedAt || 0) >= 30000;
|
||||
if (previousLeaderKey && previousLeaderKey !== leader.key && settled) {
|
||||
const raceScope = isPracticeSession ? {} : { scope: `leader:${session.id}`, cooldownMs: 10000 };
|
||||
const call = triggerRaceAudio("new_leader", { ...raceScope, variables: { driverName: spokenName(leader) }, driverId: leader.driverId, competitorKey: leader.key, logData: { raceId: session.eventId, driverId: leader.driverId } });
|
||||
if (!call?.skipped) lastLeaderCallBySession.set(session.id, Date.now());
|
||||
}
|
||||
}
|
||||
// Qualifying and finals: "Anders leads, 12 laps" when the leader crosses the line, every 2 minutes.
|
||||
if (!isPracticeSession && leader?.key === key && !entry.finishedAt) {
|
||||
if (!lastLeaderCallBySession.has(session.id)) lastLeaderCallBySession.set(session.id, Date.now());
|
||||
else if (Date.now() - lastLeaderCallBySession.get(session.id) >= LEADER_UPDATE_INTERVAL_MS) {
|
||||
lastLeaderCallBySession.set(session.id, Date.now());
|
||||
triggerRaceAudio("leader_update", { variables: { driverName: spokenName(leader), laps: leader.laps ?? entry.laps }, driverId: leader.driverId, competitorKey: leader.key, logData: { raceId: session.eventId, sessionId: session.id, driverId: leader.driverId } });
|
||||
}
|
||||
}
|
||||
if (entry.bestLapMs && Number.isFinite(entry.bestLapMs)) {
|
||||
const bestKey = `${session.id}:${entry.key}`;
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
// Practice "hype" calls: short, upbeat stats the speaker calls during practice to cheer a
|
||||
// driver on. Pure functions: decoder_runtime.js gathers the numbers and plays what
|
||||
// pickPracticeHype returns. At most one call per lap, and at least MIN_GAP_MS between two
|
||||
// calls for the same driver (lap milestones excepted), so the speaker never nags.
|
||||
export const PRACTICE_HYPE_EVENTS = Object.freeze([
|
||||
"practice_beat_last_time", "practice_class_rank", "practice_lap_milestone", "practice_faster_streak",
|
||||
"practice_average_down", "practice_close_to_best", "practice_duel",
|
||||
]);
|
||||
export const MIN_GAP_MS = 30000;
|
||||
const COOLDOWN_MS = {
|
||||
practice_class_rank: 60000, practice_faster_streak: 120000, practice_average_down: 900000,
|
||||
practice_close_to_best: 90000, practice_duel: 300000,
|
||||
};
|
||||
const MILESTONE_EVERY = 50;
|
||||
const CLOSE_TO_BEST_MS = 100;
|
||||
const AVERAGE_WINDOW = 10;
|
||||
const AVERAGE_MIN_GAIN_MS = 200;
|
||||
const DUEL_WINDOW_MS = 200;
|
||||
const DUEL_ACTIVE_MS = 120000;
|
||||
|
||||
const average = (values) => values.reduce((sum, value) => sum + value, 0) / values.length;
|
||||
|
||||
// This driver's valid lap times in the session, oldest first.
|
||||
export function getDriverLapTimes(passings, competitorKey) {
|
||||
return (Array.isArray(passings) ? passings : [])
|
||||
.filter((item) => String(item?.competitorKey || "") === String(competitorKey || "") && item.validLap !== false && !item.suspect && Number(item.lapMs) > 500)
|
||||
.map((item) => Number(item.lapMs));
|
||||
}
|
||||
|
||||
// Laps that end a run of faster laps: 17.9, 17.6, 17.4, 17.2 is 3.
|
||||
export function countFasterStreak(laps) {
|
||||
let streak = 0;
|
||||
for (let index = laps.length - 1; index > 0 && laps[index] < laps[index - 1]; index -= 1) streak += 1;
|
||||
return streak;
|
||||
}
|
||||
|
||||
// First 10 laps against the last 10, crash and pit laps (over 130 % of the best) left out.
|
||||
export function getAverageGain(laps) {
|
||||
if (laps.length < AVERAGE_WINDOW * 2) return null;
|
||||
const best = Math.min(...laps);
|
||||
const clean = laps.filter((ms) => ms <= best * 1.3);
|
||||
if (clean.length < AVERAGE_WINDOW * 2) return null;
|
||||
const first = average(clean.slice(0, AVERAGE_WINDOW));
|
||||
const last = average(clean.slice(-AVERAGE_WINDOW));
|
||||
return { gainMs: first - last, lastAvgMs: last };
|
||||
}
|
||||
|
||||
// 1-based rank by best lap among the rows of one class (rows: { key, bestLapMs }).
|
||||
export function getClassRank(rows, key) {
|
||||
const ranked = rows.filter((row) => Number(row.bestLapMs) > 500).sort((a, b) => a.bestLapMs - b.bestLapMs);
|
||||
const index = ranked.findIndex((row) => row.key === key);
|
||||
return { rank: index >= 0 ? index + 1 : null, size: ranked.length };
|
||||
}
|
||||
|
||||
// The driver's best lap on the most recent earlier day they drove this layout.
|
||||
// sessions: [{ passings }] from any session; dayStartTs: midnight today.
|
||||
export function getLastTimeBestMs(passingLists, { driverId, layoutId, dayStartTs }) {
|
||||
const byDay = new Map();
|
||||
passingLists.forEach((passings) => (passings || []).forEach((item) => {
|
||||
if (!driverId || item?.driverId !== driverId || item.validLap === false || item.suspect) return;
|
||||
if (String(item.trackLayoutId || "") !== String(layoutId || "")) return;
|
||||
const ms = Number(item.lapMs), ts = Number(item.timestamp);
|
||||
if (!(ms > 500) || !(ts < dayStartTs)) return;
|
||||
const day = new Date(ts).toDateString();
|
||||
byDay.set(day, { ts: Math.max(byDay.get(day)?.ts || 0, ts), best: Math.min(byDay.get(day)?.best ?? Infinity, ms) });
|
||||
}));
|
||||
const latest = [...byDay.values()].sort((a, b) => b.ts - a.ts)[0];
|
||||
return latest ? latest.best : null;
|
||||
}
|
||||
|
||||
// The closest other driver on track whose best lap is within 0.2 s of this driver's.
|
||||
export function findDuelRival(rows, { key, bestLapMs, now }) {
|
||||
return rows
|
||||
.filter((row) => row.key !== key && Number(row.bestLapMs) > 500 && now - Number(row.lastTimestamp || 0) <= DUEL_ACTIVE_MS)
|
||||
.map((row) => ({ ...row, gapMs: row.bestLapMs - bestLapMs }))
|
||||
.filter((row) => Math.abs(row.gapMs) <= DUEL_WINDOW_MS)
|
||||
.sort((a, b) => Math.abs(a.gapMs) - Math.abs(b.gapMs))[0] || null;
|
||||
}
|
||||
|
||||
// ctx: { laps (incl. this lap), lapMs, previousBestMs, lapCount, classRankBefore, classRankAfter,
|
||||
// classSize, lastTimeBestMs, rival, now, memory }. memory is kept per driver per session by the
|
||||
// caller and updated here. Returns { key, variables } (gaps in ms) or null.
|
||||
export function pickPracticeHype(ctx) {
|
||||
const { laps, lapMs, previousBestMs, lapCount, now, memory } = ctx;
|
||||
memory.calledAt ||= {};
|
||||
const isPb = Boolean(previousBestMs && lapMs < previousBestMs);
|
||||
const ready = (key) => now - (memory.calledAt[key] ?? -Infinity) >= (COOLDOWN_MS[key] || 0);
|
||||
const gapOk = now - (memory.lastHypeAt ?? -Infinity) >= MIN_GAP_MS;
|
||||
const candidates = [];
|
||||
|
||||
if (isPb && ctx.lastTimeBestMs && lapMs < ctx.lastTimeBestMs && !memory.beatLastTime) {
|
||||
candidates.push({ key: "practice_beat_last_time", variables: { gapMs: ctx.lastTimeBestMs - lapMs }, once: "beatLastTime" });
|
||||
}
|
||||
if (ctx.classRankAfter && ctx.classRankAfter <= 3 && ctx.classSize >= 3 && (!ctx.classRankBefore || ctx.classRankAfter < ctx.classRankBefore)) {
|
||||
candidates.push({ key: "practice_class_rank", variables: { rank: ctx.classRankAfter } });
|
||||
}
|
||||
if (lapCount > 0 && lapCount % MILESTONE_EVERY === 0 && memory.lastMilestone !== lapCount) {
|
||||
candidates.push({ key: "practice_lap_milestone", variables: { laps: lapCount }, milestone: true });
|
||||
}
|
||||
if (countFasterStreak(laps) === 3) candidates.push({ key: "practice_faster_streak", variables: { laps: 3 } });
|
||||
if (laps.length % 5 === 0) {
|
||||
const gain = getAverageGain(laps);
|
||||
if (gain && gain.gainMs >= AVERAGE_MIN_GAIN_MS) candidates.push({ key: "practice_average_down", variables: { gapMs: gain.gainMs, avgMs: gain.lastAvgMs } });
|
||||
}
|
||||
if (!isPb && previousBestMs && laps.length >= 5 && lapMs - previousBestMs <= CLOSE_TO_BEST_MS) {
|
||||
candidates.push({ key: "practice_close_to_best", variables: { gapMs: lapMs - previousBestMs } });
|
||||
}
|
||||
if (isPb && ctx.rival) candidates.push({ key: "practice_duel", variables: { gapMs: Math.abs(ctx.rival.gapMs), ahead: ctx.rival.gapMs >= 0, rival: ctx.rival.name } });
|
||||
|
||||
const pick = candidates.find((item) => ready(item.key) && (gapOk || item.milestone));
|
||||
if (!pick) return null;
|
||||
memory.calledAt[pick.key] = now;
|
||||
memory.lastHypeAt = now;
|
||||
if (pick.milestone) memory.lastMilestone = lapCount;
|
||||
if (pick.once) memory[pick.once] = true;
|
||||
return { key: pick.key, variables: pick.variables };
|
||||
}
|
||||
+19
-2
@@ -1,3 +1,5 @@
|
||||
import { PRACTICE_HYPE_EVENTS } from "./practice_hype_logic.js";
|
||||
|
||||
export const RACE_AUDIO_PRIORITIES = Object.freeze({ pass: 0, low: 10, normal: 20, high: 30, critical: 40 });
|
||||
export const START_LIGHT_STATES = Object.freeze(["IDLE", "GRID", "READY", "LIGHT_1", "LIGHT_2", "LIGHT_3", "LIGHT_4", "LIGHT_5", "WAIT_RANDOM", "GO"]);
|
||||
|
||||
@@ -21,6 +23,8 @@ export const RACE_AUDIO_EVENT_DEFINITIONS = Object.freeze([
|
||||
event("track_record", "race", "normal", true, "effects/track_record_fanfare.wav", 2000),
|
||||
event("training_stable_pace", "training", "low", true, "", 120000),
|
||||
event("new_leader", "race", "normal", true, "", 1000),
|
||||
event("leader_update", "race", "normal"),
|
||||
...PRACTICE_HYPE_EVENTS.map((key) => event(key, "training", "low")),
|
||||
event("position_gain", "race", "low", false, "effects/position_gain.wav", 750),
|
||||
event("position_loss", "race", "low", false, "effects/position_loss.wav", 750),
|
||||
event("final_lap", "race", "high", true, "effects/final_lap.wav"),
|
||||
@@ -93,6 +97,11 @@ export function normalizeRaceAudioSettings(value = {}) {
|
||||
startSound: Object.hasOwn(START_SOUNDS, source.startSound) ? source.startSound : "tone",
|
||||
finishSound: Object.hasOwn(FINISH_SOUNDS, source.finishSound) ? source.finishSound : "stop",
|
||||
raceCallouts: source.raceCallouts === "full" ? "full" : "passing",
|
||||
// Practice hype calls (practice_hype_logic.js); never in qualifying or finals.
|
||||
practiceHype: source.practiceHype !== false,
|
||||
// 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",
|
||||
// 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)),
|
||||
@@ -109,9 +118,17 @@ export function normalizeRaceAudioSettings(value = {}) {
|
||||
export const RACE_PASSING_CALLOUT_EVENTS = Object.freeze(["personal_best", "fastest_lap", "track_record", "new_leader", "position_gain", "position_loss", "provisional_pole"]);
|
||||
const PRACTICE_TYPES = new Set(["open_practice", "free_practice", "practice"]);
|
||||
|
||||
const PRACTICE_HYPE_SET = new Set(PRACTICE_HYPE_EVENTS);
|
||||
export const LEADER_UPDATE_INTERVAL_MS = 120000;
|
||||
|
||||
export function isSilencedDuringRace(eventKey, settings, session) {
|
||||
if (!session || PRACTICE_TYPES.has(String(session.type || ""))) return false;
|
||||
if (normalizeRaceAudioSettings(settings).raceCallouts === "full") return false;
|
||||
const audio = normalizeRaceAudioSettings(settings);
|
||||
const practice = Boolean(session) && PRACTICE_TYPES.has(String(session.type || ""));
|
||||
if (PRACTICE_HYPE_SET.has(eventKey)) return !practice || !audio.practiceHype;
|
||||
if (!session || practice) return false;
|
||||
if (eventKey === "leader_update") return audio.raceLeaderCalls !== "both";
|
||||
if (eventKey === "new_leader" && audio.raceLeaderCalls !== "off") return false;
|
||||
if (audio.raceCallouts === "full") return false;
|
||||
return RACE_PASSING_CALLOUT_EVENTS.includes(eventKey);
|
||||
}
|
||||
|
||||
|
||||
@@ -252,6 +252,8 @@ export function renderSettings(deps) {
|
||||
<label class="toggle"><input type="checkbox" name="raceAudioEnabled" form="settingsForm" ${raceAudio.enabled ? "checked" : ""} /><span>${t("audio.enabled")}</span></label>
|
||||
<label class="toggle"><input type="checkbox" name="raceAudioMuted" form="settingsForm" ${raceAudio.muted ? "checked" : ""} /><span>${t("audio.mute")}</span></label>
|
||||
<label><span>${t("audio.race_callouts")}</span><select name="raceAudioRaceCallouts" form="settingsForm"><option value="passing" ${raceAudio.raceCallouts === "passing" ? "selected" : ""}>${t("audio.race_callouts_passing")}</option><option value="full" ${raceAudio.raceCallouts === "full" ? "selected" : ""}>${t("audio.race_callouts_full")}</option></select></label>
|
||||
<label class="toggle" title="${t("audio.practice_hype_hint")}"><input type="checkbox" name="raceAudioPracticeHype" form="settingsForm" ${raceAudio.practiceHype ? "checked" : ""} /><span>${t("audio.practice_hype")}</span></label>
|
||||
<label><span>${t("audio.race_leader_calls")}</span><select name="raceAudioLeaderCalls" form="settingsForm">${["both", "change", "off"].map((value) => `<option value="${value}" ${raceAudio.raceLeaderCalls === value ? "selected" : ""}>${t("audio.race_leader_" + value)}</option>`).join("")}</select></label>
|
||||
<label title="${t("audio.practice_pb_hint")}"><span>${t("audio.practice_pb_warmup")}</span><input type="number" min="0" max="30" step="1" name="raceAudioPbWarmup" form="settingsForm" value="${raceAudio.practicePbWarmupLaps}" /></label>
|
||||
<label title="${t("audio.practice_pb_hint")}"><span>${t("audio.practice_pb_cooldown")}</span><input type="number" min="0" max="600" step="10" name="raceAudioPbCooldown" form="settingsForm" value="${raceAudio.practicePbCooldownSec}" /></label>
|
||||
<label title="${t("audio.practice_pb_hint")}"><span>${t("audio.practice_pb_min_gain")}</span><input type="number" min="0" max="2" step="0.05" name="raceAudioPbMinGain" form="settingsForm" value="${raceAudio.practicePbMinGainMs / 1000}" /></label>
|
||||
@@ -637,6 +639,8 @@ Erik Eriksson;654321;4WD;Associated;;</code></pre>
|
||||
randomStartDelay: form.get("raceAudioRandomDelay") === "on", minStartDelay: Number(form.get("raceAudioMinDelay")),
|
||||
maxStartDelay: Number(form.get("raceAudioMaxDelay")), perCompetitorPassingTone: form.get("raceAudioPerCompetitor") === "on",
|
||||
raceCallouts: String(form.get("raceAudioRaceCallouts") || "passing"),
|
||||
practiceHype: form.get("raceAudioPracticeHype") === "on",
|
||||
raceLeaderCalls: String(form.get("raceAudioLeaderCalls") || "both"),
|
||||
startSound: String(form.get("raceAudioStartSound") || "tone"),
|
||||
finishSound: String(form.get("raceAudioFinishSound") || "stop"),
|
||||
practicePbWarmupLaps: Number(form.get("raceAudioPbWarmup")),
|
||||
|
||||
Reference in new issue
Block a user