feat(audio): 'starting to the sound of the tone' call, tone start and stop signal finish by default (1.57.0)
This commit is contained in:
1 parent
a8aaeae02f
commit
221a06c899
14 files changed
+54
-39
No files matched your search
+14
-13
@@ -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_trumpet.wav"], ["timing-start"]]);
|
||||
assert.deepEqual(calls.slice(-3), [["wait", 2500], ["effect", "/race-sounds/sounds/effects/start_tone.wav"], ["timing-start"]]);
|
||||
});
|
||||
|
||||
test("staggered start mode calls out each car in grid order, 3s apart, after the official start", async () => {
|
||||
@@ -105,20 +105,21 @@ 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_trumpet.wav"], ["timing-start"], ["voice", "Klockan går."]]);
|
||||
assert.deepEqual(calls, [["effect", "start_tone.wav"], ["timing-start"], ["voice", "Klockan går."]]);
|
||||
});
|
||||
|
||||
test("after the prologue a grid start skips its own count-down and intro calls", async () => {
|
||||
test("after the prologue a grid start skips its own count-down, says 'start on the tone' and gives the tone", async () => {
|
||||
const calls = [];
|
||||
const engine = createRecordingEngine(calls, { startCountdownSeconds: 30 });
|
||||
await engine.runStartSequence({ id: "f1", type: "final", startMode: "position" }, { onTone: () => calls.push(["timing-start"]), skipCountdown: true, skipIntro: true });
|
||||
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_trumpet.wav"], ["timing-start"]]);
|
||||
assert.equal(calls.length, 4, "the call, the quiet and the tone");
|
||||
assert.deepEqual(calls[0], ["voice", "Start på signalen"]);
|
||||
assert.equal(calls[1][0], "wait");
|
||||
assert.ok(calls[1][1] >= 1000 && calls[1][1] <= 3000, "1-3 s of quiet");
|
||||
assert.deepEqual(calls.slice(2), [["effect", "start_tone.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 () => {
|
||||
test("after the count-down's 3 and the tone call it is quiet until the tone 1-3 s later, with the lights inside that time", async () => {
|
||||
for (const [roll, totalMs] of [[0, 1000], [1, 3000]]) {
|
||||
const calls = [];
|
||||
const engine = createRaceAudioEngine({
|
||||
@@ -130,10 +131,10 @@ test("after the count-down's 3 it is quiet until the horn 1-3 s later, with the
|
||||
getSettings: () => normalizeRaceAudioSettings({ startLights: true, lightIntervalMs: 1000, minStartDelay: 4, maxStartDelay: 8 }),
|
||||
});
|
||||
await engine.runStartSequence({ id: "f1", type: "final", startMode: "position" }, { skipCountdown: true, skipIntro: true });
|
||||
assert.equal(calls.filter(([kind]) => kind === "voice").length, 0, "nothing is said");
|
||||
assert.equal(calls.filter(([kind]) => kind === "voice").length, 1, "only 'start on the tone' 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_trumpet.wav"]);
|
||||
assert.deepEqual(calls.at(-1), ["effect", "start_tone.wav"]);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -314,13 +315,13 @@ test("count-down calls replace each other instead of queueing, and late ones are
|
||||
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"]]) {
|
||||
test("the start and finish signals are chosen in Settings: tone and stop signal by default", async () => {
|
||||
for (const [settings, start, finish] of [[{}, "start_tone.wav", "finish_stop.wav"], [{ startSound: "trumpet", finishSound: "fanfare" }, "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");
|
||||
assert.equal(normalizeRaceAudioSettings({ startSound: "nope" }).startSound, "tone");
|
||||
});
|
||||
@@ -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_trumpet.wav");
|
||||
assert.equal(soundManifest.events.start_tone.effect, "effects/start_tone.wav");
|
||||
assert.equal(soundManifest.voice_events.sv.track_call, "Stopp på banan. Stopp på banan.");
|
||||
|
||||
const ammcConfigResponse = await fetch(`${baseUrl}/api/ammc/config`, {
|
||||
|
||||
Reference in new issue
Block a user