feat(audio): good pace call says the average of the steady laps (1.60.0)
This commit is contained in:
1 parent
12572ee31c
commit
f602778895
7 files changed
+23
-10
No files matched your search
@@ -578,10 +578,14 @@ export function processDecoderMessageHelper(msg, deps, decoderRole = "main") {
|
||||
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) {
|
||||
const controlTargetMs = entry.bestLapMs ? Math.round(entry.bestLapMs * 1.08) : 0;
|
||||
const controlledLapStreak = getControlledLapStreak(getCurrentPracticePaceLaps(result, key), controlTargetMs);
|
||||
const paceLaps = getCurrentPracticePaceLaps(result, key);
|
||||
const controlledLapStreak = getControlledLapStreak(paceLaps, controlTargetMs);
|
||||
if (controlledLapStreak >= 5 && controlledLapStreak % 5 === 0) {
|
||||
// Average of the steady laps just called, e.g. "Average 18.17".
|
||||
const streakLaps = paceLaps.slice(-controlledLapStreak);
|
||||
const avgLapMs = streakLaps.reduce((sum, ms) => sum + ms, 0) / streakLaps.length;
|
||||
triggerRaceAudio("training_stable_pace", {
|
||||
variables: { ...audioVariables, laps: controlledLapStreak },
|
||||
variables: { ...audioVariables, laps: controlledLapStreak, avgLap: formatSpokenLapTime(avgLapMs, normalizeRaceAudioSettings(state.settings?.raceAudio).language) },
|
||||
driverId: entry.driverId,
|
||||
competitorKey: key,
|
||||
scope: entry.driverId,
|
||||
|
||||
+1
-1
@@ -738,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
|
||||
// write those still-unsaved changes to the database. Use the explicit Save button for that.
|
||||
applyRaceAudioFormValuesFromDom();
|
||||
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" } });
|
||||
triggerRaceAudio(eventKey, { force: true, interrupt: true, variables: { driverName: state.drivers[0]?.name || "Driver", lapTime: formatSpokenLapTime(16000, state.settings.raceAudio?.language), avgLap: formatSpokenLapTime(16420, state.settings.raceAudio?.language), laps: 5, marshalPost: "1", transponder: "123", podium: "P1, P2, P3" } });
|
||||
};
|
||||
document.getElementById("settingsRaceAudioTest")?.addEventListener("click", () => testRaceAudio("audio_test"));
|
||||
document.querySelectorAll("[data-test-race-audio]").forEach((button) => button.addEventListener("click", () => testRaceAudio(button.dataset.testRaceAudio)));
|
||||
|
||||
Reference in new issue
Block a user