fix(audio): speak lap times as seconds with hundredths, no leading zero (1.59.1)
This commit is contained in:
1 parent
db6a9f19e4
commit
12572ee31c
8 files changed
+35
-9
No files matched your search
@@ -8,6 +8,12 @@ The application version is maintained in `package.json` and displayed in the adm
|
|||||||
|
|
||||||
No changes recorded yet.
|
No changes recorded yet.
|
||||||
|
|
||||||
|
## 1.59.1 - 2026-11-05
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Lap times in announcements (personal best, fastest lap, track record) are spoken as seconds with hundredths: "17,18" instead of "0:17.180", which voices read as "zero 17 comma 180". Laps over a minute are called as "1 minut 5,32". The driver and settings voice tests use the same format.
|
||||||
|
|
||||||
## 1.59.0 - 2026-11-04
|
## 1.59.0 - 2026-11-04
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "rc-racecore",
|
"name": "rc-racecore",
|
||||||
"version": "1.59.0",
|
"version": "1.59.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "rc-racecore",
|
"name": "rc-racecore",
|
||||||
"version": "1.59.0",
|
"version": "1.59.1",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"better-sqlite3": "^12.11.1",
|
"better-sqlite3": "^12.11.1",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rc-racecore",
|
"name": "rc-racecore",
|
||||||
"version": "1.59.0",
|
"version": "1.59.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "RC RaceCore live timing and race control with AMMC ingest and SQLite persistence",
|
"description": "RC RaceCore live timing and race control with AMMC ingest and SQLite persistence",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
+2
-2
@@ -13,7 +13,7 @@ import { renderDaySchedulePanel, bindDaySchedulePanel, buildDaySchedulePrintHtml
|
|||||||
import { beginSession as beginSessionControl, finishSession as finishSessionControl, pauseSession as pauseSessionControl, resumeSession as resumeSessionControl } from "./session_control.js";
|
import { beginSession as beginSessionControl, finishSession as finishSessionControl, pauseSession as pauseSessionControl, resumeSession as resumeSessionControl } from "./session_control.js";
|
||||||
import { normalizeSeries, buildSeriesStandings, getSeriesRoundStatus, getSeriesRoundNextStep, getSeriesDayResult } from "./series_logic.js";
|
import { normalizeSeries, buildSeriesStandings, getSeriesRoundStatus, getSeriesRoundNextStep, getSeriesDayResult } from "./series_logic.js";
|
||||||
import { renderSeriesView } from "./series_view.js";
|
import { renderSeriesView } from "./series_view.js";
|
||||||
import { RACE_AUDIO_EVENT_DEFINITIONS, createRaceAudioEngine, normalizeRaceAudioSettings, isSilencedDuringRace } from "./race_audio.js";
|
import { RACE_AUDIO_EVENT_DEFINITIONS, createRaceAudioEngine, normalizeRaceAudioSettings, isSilencedDuringRace, formatSpokenLapTime } from "./race_audio.js";
|
||||||
|
|
||||||
import { renderRaceFormatField, renderRaceFormatContextCard, getRaceSummaryItems, getRaceSummaryWarnings, renderManageStatusBadge, renderRaceWizardSteps, renderRaceWizardContent, renderRaceStandingsTable } from "./race_setup_ui.js";
|
import { renderRaceFormatField, renderRaceFormatContextCard, getRaceSummaryItems, getRaceSummaryWarnings, renderManageStatusBadge, renderRaceWizardSteps, renderRaceWizardContent, renderRaceStandingsTable } from "./race_setup_ui.js";
|
||||||
|
|
||||||
@@ -679,7 +679,7 @@ const testDriverVoice = ({ spokenName, passSound }) => {
|
|||||||
if (!spokenName) return;
|
if (!spokenName) return;
|
||||||
ensureAudioContext();
|
ensureAudioContext();
|
||||||
triggerRaceAudio("transponder_pass", { force: true, effectPath: passSound || "" });
|
triggerRaceAudio("transponder_pass", { force: true, effectPath: passSound || "" });
|
||||||
const variables = { driverName: spokenName, lapTime: formatLap(16420), podium: spokenName };
|
const variables = { driverName: spokenName, lapTime: formatSpokenLapTime(16420, state.settings.raceAudio?.language), podium: spokenName };
|
||||||
triggerRaceAudio("personal_best", { force: true, interrupt: true, variables });
|
triggerRaceAudio("personal_best", { force: true, interrupt: true, variables });
|
||||||
triggerRaceAudio("race_winner", { force: true, variables });
|
triggerRaceAudio("race_winner", { force: true, variables });
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { getControlledLapStreak } from "./training_logic.js";
|
|||||||
import { usesPersonalClock, getLatestClockStartTs } from "./prologue_logic.js";
|
import { usesPersonalClock, getLatestClockStartTs } from "./prologue_logic.js";
|
||||||
import { isSuspectLap, getSuspectReferenceLaps, releaseSettledSuspectLaps } from "./suspect_laps_logic.js";
|
import { isSuspectLap, getSuspectReferenceLaps, releaseSettledSuspectLaps } from "./suspect_laps_logic.js";
|
||||||
import { shouldCallPracticePersonalBest } from "./practice_callouts_logic.js";
|
import { shouldCallPracticePersonalBest } from "./practice_callouts_logic.js";
|
||||||
import { normalizeRaceAudioSettings } from "./race_audio.js";
|
import { normalizeRaceAudioSettings, formatSpokenLapTime } from "./race_audio.js";
|
||||||
import { decoderClockCheck, describeDecoderClockSkew } from "./decoder_clock_check.js";
|
import { decoderClockCheck, describeDecoderClockSkew } from "./decoder_clock_check.js";
|
||||||
import { getCompetitorEndTs } from "./timing_logic.js";
|
import { getCompetitorEndTs } from "./timing_logic.js";
|
||||||
|
|
||||||
@@ -575,7 +575,7 @@ export function processDecoderMessageHelper(msg, deps, decoderRole = "main") {
|
|||||||
pushOverlayEvent("passing", `${entry.displayName || entry.driverName} • ${formatLap(entry.lastLapMs)}`);
|
pushOverlayEvent("passing", `${entry.displayName || entry.driverName} • ${formatLap(entry.lastLapMs)}`);
|
||||||
const leaderboard = buildLeaderboard(session);
|
const leaderboard = buildLeaderboard(session);
|
||||||
const currentPosition = leaderboard.findIndex((row) => row.key === key);
|
const currentPosition = leaderboard.findIndex((row) => row.key === key);
|
||||||
const audioVariables = { driverName: entry.speechName || entry.displayName || entry.driverName, lapTime: formatLap(lapMs) };
|
const audioVariables = { driverName: entry.speechName || entry.displayName || entry.driverName, lapTime: formatSpokenLapTime(lapMs, normalizeRaceAudioSettings(state.settings?.raceAudio).language) };
|
||||||
if (entry.driverId && PRACTICE_SESSION_TYPES.has(String(session.type || "").toLowerCase()) && !validationWarning) {
|
if (entry.driverId && PRACTICE_SESSION_TYPES.has(String(session.type || "").toLowerCase()) && !validationWarning) {
|
||||||
const controlTargetMs = entry.bestLapMs ? Math.round(entry.bestLapMs * 1.08) : 0;
|
const controlTargetMs = entry.bestLapMs ? Math.round(entry.bestLapMs * 1.08) : 0;
|
||||||
const controlledLapStreak = getControlledLapStreak(getCurrentPracticePaceLaps(result, key), controlTargetMs);
|
const controlledLapStreak = getControlledLapStreak(getCurrentPracticePaceLaps(result, key), controlTargetMs);
|
||||||
|
|||||||
@@ -115,6 +115,17 @@ export function isSilencedDuringRace(eventKey, settings, session) {
|
|||||||
return RACE_PASSING_CALLOUT_EVENTS.includes(eventKey);
|
return RACE_PASSING_CALLOUT_EVENTS.includes(eventKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A lap time as the speaker says it: "17,18" (sv) / "17.18" (en), not "0:17.180", which voices
|
||||||
|
// read as "zero 17 comma 180". Hundredths, cut not rounded, as on the timing screens.
|
||||||
|
export function formatSpokenLapTime(ms, language = "sv") {
|
||||||
|
const value = Math.max(0, Math.floor(Number(ms) || 0));
|
||||||
|
if (!value) return "";
|
||||||
|
const minutes = Math.floor(value / 60000);
|
||||||
|
const sep = language === "en" ? "." : ",";
|
||||||
|
const seconds = `${Math.floor((value % 60000) / 1000)}${sep}${String(Math.floor((value % 1000) / 10)).padStart(2, "0")}`;
|
||||||
|
if (!minutes) return seconds;
|
||||||
|
return language === "en" ? `${minutes} ${minutes === 1 ? "minute" : "minutes"} ${seconds}` : `${minutes} ${minutes === 1 ? "minut" : "minuter"} ${seconds}`;
|
||||||
|
}
|
||||||
const joinUrl = (baseUrl, filePath) => `${String(baseUrl || "").replace(/\/+$/, "")}/${String(filePath || "").replace(/^\/+/, "")}`;
|
const joinUrl = (baseUrl, filePath) => `${String(baseUrl || "").replace(/\/+$/, "")}/${String(filePath || "").replace(/^\/+/, "")}`;
|
||||||
const interpolate = (template, variables = {}) => String(template || "").replace(/\{(\w+)\}/g, (_match, key) => String(variables[key] ?? ""));
|
const interpolate = (template, variables = {}) => String(template || "").replace(/\{(\w+)\}/g, (_match, key) => String(variables[key] ?? ""));
|
||||||
function safeEffectPath(value) {
|
function safeEffectPath(value) {
|
||||||
|
|||||||
+2
-1
@@ -2,6 +2,7 @@ import { normalizePublicBaseUrl } from "./public_url.js";
|
|||||||
import { decoderDiagnosticsMarkup, mountDecoderDiagnostics } from "./decoder_diagnostics_view.js";
|
import { decoderDiagnosticsMarkup, mountDecoderDiagnostics } from "./decoder_diagnostics_view.js";
|
||||||
import { mountAuthSettings } from "./auth_view.js";
|
import { mountAuthSettings } from "./auth_view.js";
|
||||||
import { mountTtsSettings } from "./tts_settings_view.js";
|
import { mountTtsSettings } from "./tts_settings_view.js";
|
||||||
|
import { formatSpokenLapTime } from "./race_audio.js";
|
||||||
|
|
||||||
let activeSettingsTab = "connection";
|
let activeSettingsTab = "connection";
|
||||||
let pendingSettingsFocusId = "";
|
let pendingSettingsFocusId = "";
|
||||||
@@ -737,7 +738,7 @@ Erik Eriksson;654321;4WD;Associated;;</code></pre>
|
|||||||
// matches what you're about to hear - but a test playback is not itself a reason to
|
// matches what you're about to hear - but a test playback is not itself a reason to
|
||||||
// write those still-unsaved changes to the database. Use the explicit Save button for that.
|
// write those still-unsaved changes to the database. Use the explicit Save button for that.
|
||||||
applyRaceAudioFormValuesFromDom();
|
applyRaceAudioFormValuesFromDom();
|
||||||
triggerRaceAudio(eventKey, { force: true, interrupt: true, variables: { driverName: state.drivers[0]?.name || "Driver", lapTime: "16.000", marshalPost: "1", transponder: "123", podium: "P1, P2, P3" } });
|
triggerRaceAudio(eventKey, { force: true, interrupt: true, variables: { driverName: state.drivers[0]?.name || "Driver", lapTime: formatSpokenLapTime(16000, state.settings.raceAudio?.language), marshalPost: "1", transponder: "123", podium: "P1, P2, P3" } });
|
||||||
};
|
};
|
||||||
document.getElementById("settingsRaceAudioTest")?.addEventListener("click", () => testRaceAudio("audio_test"));
|
document.getElementById("settingsRaceAudioTest")?.addEventListener("click", () => testRaceAudio("audio_test"));
|
||||||
document.querySelectorAll("[data-test-race-audio]").forEach((button) => button.addEventListener("click", () => testRaceAudio(button.dataset.testRaceAudio)));
|
document.querySelectorAll("[data-test-race-audio]").forEach((button) => button.addEventListener("click", () => testRaceAudio(button.dataset.testRaceAudio)));
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import test from "node:test";
|
import test from "node:test";
|
||||||
import assert from "node:assert/strict";
|
import assert from "node:assert/strict";
|
||||||
import { RACE_AUDIO_EVENT_DEFINITIONS, createRaceAudioEngine, normalizeRaceAudioSettings, isSilencedDuringRace } from "../src/race_audio.js";
|
import { RACE_AUDIO_EVENT_DEFINITIONS, createRaceAudioEngine, normalizeRaceAudioSettings, isSilencedDuringRace, formatSpokenLapTime } from "../src/race_audio.js";
|
||||||
|
|
||||||
const manifest = {
|
const manifest = {
|
||||||
events: { transponder_pass: { effect: "effects/transponder_pass.wav" }, start_tone: { effect: "effects/start_beep.wav" } },
|
events: { transponder_pass: { effect: "effects/transponder_pass.wav" }, start_tone: { effect: "effects/start_beep.wav" } },
|
||||||
@@ -325,3 +325,11 @@ test("the start and finish signals are chosen in Settings: tone and stop signal
|
|||||||
}
|
}
|
||||||
assert.equal(normalizeRaceAudioSettings({ startSound: "nope" }).startSound, "tone");
|
assert.equal(normalizeRaceAudioSettings({ startSound: "nope" }).startSound, "tone");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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");
|
||||||
|
});
|
||||||
Reference in new issue
Block a user