feat(audio): 'starting to the sound of the tone' call, tone start and stop signal finish by default (1.57.0)

This commit is contained in:
larssand committed 2026-11-03 11:41:33 +01:00
1 parent a8aaeae02f
commit 221a06c899
14 files changed
+54 -39

No files matched your search

+11 -8
View File
@@ -7,7 +7,7 @@ export const RACE_AUDIO_EVENT_DEFINITIONS = Object.freeze([
event("race_1_minute", "start", "normal"), event("race_30_seconds", "start", "normal"),
event("race_10_seconds", "start", "normal", true, "effects/warning.wav"),
event("drivers_ready", "start", "high"), event("start_sequence", "start", "high"),
event("start_tone", "start", "high", false, "effects/start_trumpet.wav"),
event("start_tone", "start", "high", false, "effects/start_tone.wav"),
event("false_start", "start", "critical", true, "effects/warning.wav", 1000), event("restart_race", "start", "high"),
event("staggered_release", "start", "normal"),
event("prologue_start", "start", "normal"), event("prologue_minutes", "start", "normal"),
@@ -27,7 +27,7 @@ export const RACE_AUDIO_EVENT_DEFINITIONS = Object.freeze([
event("one_minute_remaining", "race", "normal"), event("thirty_seconds_remaining", "race", "normal"),
event("ten_seconds_remaining", "race", "normal", true, "effects/warning.wav"),
event("time_expired", "race", "high", true, "effects/warning.wav"),
event("race_finished", "race", "high", true, "effects/finish_fanfare.wav"),
event("race_finished", "race", "high", true, "effects/finish_stop.wav"),
event("track_call", "control", "critical", true, "effects/warning.wav", 1000), event("track_clear", "control", "critical"),
event("yellow_flag", "control", "critical", true, "effects/warning.wav"), event("red_flag", "control", "critical", true, "effects/warning.wav"),
event("race_paused", "control", "critical", true, "effects/warning.wav"), event("race_resumed", "control", "high"),
@@ -38,7 +38,7 @@ export const RACE_AUDIO_EVENT_DEFINITIONS = Object.freeze([
event("entering_pits", "pit", "low", false, "effects/transponder_pass.wav"), event("leaving_pits", "pit", "low", false, "effects/transponder_pass.wav"),
event("pit_speed_warning", "pit", "high", true, "effects/warning.wav"),
event("qualifying_start", "qualifying", "high"), event("qualifying_remaining", "qualifying", "normal"),
event("qualifying_finished", "qualifying", "high", true, "effects/finish_fanfare.wav"), event("provisional_pole", "qualifying", "normal"),
event("qualifying_finished", "qualifying", "high", true, "effects/finish_stop.wav"), event("provisional_pole", "qualifying", "normal"),
event("pole_position", "qualifying", "normal", true, "effects/fastest_lap_trophy.wav"),
event("race_winner", "results", "high", true, "effects/fastest_lap_trophy.wav"), event("second_place", "results", "normal"),
event("third_place", "results", "normal"), event("podium", "results", "normal"),
@@ -56,8 +56,8 @@ const clamp = (value, fallback, min = 0, max = 1) => {
};
// The start and finish signals can be chosen in Settings (the files are in the sound pack).
export const START_SOUNDS = Object.freeze({ trumpet: "effects/start_trumpet.wav", horn: "effects/start_horn.wav", beep: "effects/start_beep.wav" });
export const FINISH_SOUNDS = Object.freeze({ fanfare: "effects/finish_fanfare.wav", horn: "effects/finish_horn.wav", classic: "effects/race_finish.wav" });
export const START_SOUNDS = Object.freeze({ tone: "effects/start_tone.wav", trumpet: "effects/start_trumpet.wav", horn: "effects/start_horn.wav", beep: "effects/start_beep.wav" });
export const FINISH_SOUNDS = Object.freeze({ stop: "effects/finish_stop.wav", fanfare: "effects/finish_fanfare.wav", horn: "effects/finish_horn.wav", classic: "effects/race_finish.wav" });
const FINISH_EVENTS = new Set(["race_finished", "qualifying_finished"]);
export function normalizeRaceAudioSettings(value = {}) {
@@ -90,8 +90,8 @@ export function normalizeRaceAudioSettings(value = {}) {
minStartDelay,
maxStartDelay,
perCompetitorPassingTone: source.perCompetitorPassingTone === true,
startSound: Object.hasOwn(START_SOUNDS, source.startSound) ? source.startSound : "trumpet",
finishSound: Object.hasOwn(FINISH_SOUNDS, source.finishSound) ? source.finishSound : "fanfare",
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",
// Open Practice personal best calls (practice_callouts_logic.js); 0 turns a rule off.
practicePbWarmupLaps: Math.round(clamp(source.practicePbWarmupLaps, 10, 0, 30)),
@@ -327,8 +327,11 @@ export function createRaceAudioEngine(options = {}) {
await trigger("drivers_ready", { interrupt: true }).voiceDone; if (cancelled()) return false;
if (session?.type === "qualification") await trigger("qualifying_start").voiceDone; if (cancelled()) return false;
await trigger("start_sequence").voiceDone; if (cancelled()) return false;
} else {
// After the count-down's "3": "Starting to the sound of the tone", like a timing system.
await trigger("start_sequence").voiceDone; if (cancelled()) return false;
}
// After the count-down's "3" (IFMAR 4.2.6) it is quiet until the horn, 1-3 s later; the
// After that call it is quiet until the tone, 1-3 s later (IFMAR 4.2.6); the
// lights come on within that time. Otherwise: lights, then the random delay from settings.
const afterCountDown = Boolean(callbacks.skipIntro);
const windowMs = afterCountDown ? 1000 + random() * 2000 : 0;