feat(audio): passing tone only during races and remove legacy audio
Adds 'Calls during a race' (default: passing tone only, like timing systems) that drops name/personal best/leader/position calls in race sessions; practice keeps them. Removes the legacy audio panel and fallbacks, including its 'Sound on' switch that silently muted every race-audio voice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { RACE_AUDIO_EVENT_DEFINITIONS, createRaceAudioEngine, normalizeRaceAudioSettings } from "../src/race_audio.js";
|
||||
import { RACE_AUDIO_EVENT_DEFINITIONS, createRaceAudioEngine, normalizeRaceAudioSettings, isSilencedDuringRace } from "../src/race_audio.js";
|
||||
|
||||
const manifest = {
|
||||
events: { transponder_pass: { effect: "effects/transponder_pass.wav" }, start_tone: { effect: "effects/start_beep.wav" } },
|
||||
@@ -115,6 +115,20 @@ test("after the prologue a grid start skips its own count-down and intro calls",
|
||||
assert.deepEqual(calls, [["wait", 2000], ["effect", "start_beep.wav"], ["timing-start"]], "only the 0-5 s delay and the horn are left");
|
||||
});
|
||||
|
||||
test("during a race only the passing tone plays by default - no names, personal bests or leader calls", () => {
|
||||
const race = { type: "heat" };
|
||||
assert.equal(normalizeRaceAudioSettings({}).raceCallouts, "passing");
|
||||
["personal_best", "fastest_lap", "track_record", "new_leader", "position_gain", "position_loss"].forEach((key) => {
|
||||
assert.equal(isSilencedDuringRace(key, {}, race), true, key);
|
||||
});
|
||||
["transponder_pass", "final_lap", "one_minute_remaining", "race_finished", "race_winner", "clock_running"].forEach((key) => {
|
||||
assert.equal(isSilencedDuringRace(key, {}, race), false, `${key} is not a per-passing call`);
|
||||
});
|
||||
assert.equal(isSilencedDuringRace("personal_best", { raceCallouts: "full" }, race), false, "speaker mode keeps the calls");
|
||||
assert.equal(isSilencedDuringRace("personal_best", {}, { type: "open_practice" }), false, "practice keeps the calls");
|
||||
assert.equal(isSilencedDuringRace("personal_best", {}, null), false);
|
||||
});
|
||||
|
||||
test("a mass-start session never calls out individual cars, even if a grid order is passed", async () => {
|
||||
const calls = [];
|
||||
const engine = createRaceAudioEngine({
|
||||
|
||||
Reference in New Issue
Block a user