feat(audio): speak lap times as seconds and hundredths, "18 sixty-three" (1.89.2)

This commit is contained in:
larssand committed 2026-11-10 18:45:04 +01:00
1 parent 379dd52c7f
commit dd2fc6bd89
7 files changed
+37 -14

No files matched your search

+9 -6
View File
@@ -1,6 +1,6 @@
import test from "node:test";
import assert from "node:assert/strict";
import { RACE_AUDIO_EVENT_DEFINITIONS, createRaceAudioEngine, normalizeRaceAudioSettings, isSilencedDuringRace, formatSpokenLapTime, formatShortLapCall } from "../src/race_audio.js";
import { RACE_AUDIO_EVENT_DEFINITIONS, createRaceAudioEngine, normalizeRaceAudioSettings, isSilencedDuringRace, formatSpokenLapTime, formatSpokenGap, formatShortLapCall } from "../src/race_audio.js";
const manifest = {
events: { transponder_pass: { effect: "effects/transponder_pass.wav" }, start_tone: { effect: "effects/start_beep.wav" } },
@@ -331,11 +331,14 @@ test("the start and finish signals are chosen in Settings: tone and stop signal
});
test("lap times are spoken as seconds with hundredths, no leading zero minute", () => {
assert.equal(formatSpokenLapTime(17189, "sv"), "17,18");
assert.equal(formatSpokenLapTime(17189, "en"), "17.18");
assert.equal(formatSpokenLapTime(9050, "sv"), "9,05");
assert.equal(formatSpokenLapTime(65320, "sv"), "1 minut 5,32");
assert.equal(formatSpokenLapTime(125000, "en"), "2 minutes 5.00");
assert.equal(formatSpokenLapTime(18639, "sv"), "18 63");
assert.equal(formatSpokenLapTime(18639, "en"), "18 63");
assert.equal(formatSpokenLapTime(9050, "sv"), "9 05");
assert.equal(formatSpokenLapTime(65320, "sv"), "1 minut 05 32");
assert.equal(formatSpokenLapTime(125000, "en"), "2 minutes 05 flat");
assert.equal(formatSpokenLapTime(18004, "sv"), "18 jämnt");
assert.equal(formatSpokenGap(300, "sv"), "0,30");
assert.equal(formatSpokenGap(1250, "en"), "1.25");
});
test("practice hype calls only sound in practice and can be turned off", () => {