feat(audio): trumpet start and fanfare finish by default, start/finish signal chosen in settings (1.56.0)

This commit is contained in:
larssand committed 2026-11-03 09:26:19 +01:00
1 parent 36fe1e3933
commit a8aaeae02f
15 files changed
+73 -21

No files matched your search

+15 -4
View File
@@ -63,7 +63,7 @@ test("start lights, random delay and tone precede the official start callback",
await engine.runStartSequence({ id: "race", type: "final" }, { onTone: () => calls.push(["timing-start"]) });
assert.deepEqual(states, ["IDLE", "GRID", "READY", "LIGHT_1", "LIGHT_2", "LIGHT_3", "LIGHT_4", "LIGHT_5", "WAIT_RANDOM", "GO"]);
assert.equal(calls.at(-1)[0], "timing-start");
assert.deepEqual(calls.slice(-3), [["wait", 2500], ["effect", "/race-sounds/sounds/effects/start_beep.wav"], ["timing-start"]]);
assert.deepEqual(calls.slice(-3), [["wait", 2500], ["effect", "/race-sounds/sounds/effects/start_trumpet.wav"], ["timing-start"]]);
});
test("staggered start mode calls out each car in grid order, 3s apart, after the official start", async () => {
@@ -105,7 +105,7 @@ test("a flying start has no start procedure: horn, then 'clock is running' (EFRA
await engine.runStartSequence({ id: "q1", type: "qualification", startMode: "flying" }, { onTone: () => calls.push(["timing-start"]), skipCountdown: true });
await new Promise((resolve) => setImmediate(resolve));
assert.deepEqual(states, ["IDLE", "GRID", "GO"], "no lights and no random delay");
assert.deepEqual(calls, [["effect", "start_beep.wav"], ["timing-start"], ["voice", "Klockan går."]]);
assert.deepEqual(calls, [["effect", "start_trumpet.wav"], ["timing-start"], ["voice", "Klockan går."]]);
});
test("after the prologue a grid start skips its own count-down and intro calls", async () => {
@@ -115,7 +115,7 @@ test("after the prologue a grid start skips its own count-down and intro calls",
assert.equal(calls.length, 3, "only the quiet and the horn are left");
assert.equal(calls[0][0], "wait");
assert.ok(calls[0][1] >= 1000 && calls[0][1] <= 3000, "1-3 s of quiet");
assert.deepEqual(calls.slice(1), [["effect", "start_beep.wav"], ["timing-start"]]);
assert.deepEqual(calls.slice(1), [["effect", "start_trumpet.wav"], ["timing-start"]]);
});
test("after the count-down's 3 it is quiet until the horn 1-3 s later, with the lights inside that time", async () => {
@@ -133,7 +133,7 @@ test("after the count-down's 3 it is quiet until the horn 1-3 s later, with the
assert.equal(calls.filter(([kind]) => kind === "voice").length, 0, "nothing is said");
const waited = calls.filter(([kind]) => kind === "wait").reduce((sum, [, ms]) => sum + ms, 0);
assert.ok(Math.abs(waited - totalMs) <= 6, `horn ${totalMs} ms after the 3, was ${waited}`);
assert.deepEqual(calls.at(-1), ["effect", "start_beep.wav"]);
assert.deepEqual(calls.at(-1), ["effect", "start_trumpet.wav"]);
}
});
@@ -313,3 +313,14 @@ test("count-down calls replace each other instead of queueing, and late ones are
assert.equal(await late.voiceDone, false);
assert.ok(!spoken.includes("6"));
});
test("the start and finish signals are chosen in Settings: trumpet and fanfare by default", async () => {
for (const [settings, start, finish] of [[{}, "start_trumpet.wav", "finish_fanfare.wav"], [{ startSound: "horn", finishSound: "classic" }, "start_horn.wav", "race_finish.wav"]]) {
const calls = [];
const engine = createRecordingEngine(calls, settings);
await engine.playEffect("start_tone", { force: true });
await engine.playEffect("race_finished", { force: true });
assert.deepEqual(calls, [["effect", start], ["effect", finish]]);
}
assert.equal(normalizeRaceAudioSettings({ startSound: "nope" }).startSound, "trumpet");
});
+1 -1
View File
@@ -115,7 +115,7 @@ test("SQLite API persists state, passings, and overlay session results", { timeo
const soundManifestResponse = await fetch(`${baseUrl}/race-sounds/sound_manifest.json`);
const soundManifest = await soundManifestResponse.json();
assert.equal(soundManifestResponse.status, 200);
assert.equal(soundManifest.events.start_tone.effect, "effects/start_horn.wav");
assert.equal(soundManifest.events.start_tone.effect, "effects/start_trumpet.wav");
assert.equal(soundManifest.voice_events.sv.track_call, "Stopp på banan. Stopp på banan.");
const ammcConfigResponse = await fetch(`${baseUrl}/api/ammc/config`, {