diff --git a/frontend/src/ts/controllers/sound-controller.ts b/frontend/src/ts/controllers/sound-controller.ts index 007774b11b38..84715e272e86 100644 --- a/frontend/src/ts/controllers/sound-controller.ts +++ b/frontend/src/ts/controllers/sound-controller.ts @@ -638,6 +638,11 @@ export async function playTimeWarning(): Promise { soundToPlay.play(); } +export async function clearAllSounds(): Promise { + const Howl = (await gethowler()).Howler; + Howl.stop(); +} + function playNote( codeOverride?: string, oscillatorTypeOverride?: SupportedOscillatorTypes, diff --git a/frontend/src/ts/test/test-logic.ts b/frontend/src/ts/test/test-logic.ts index 61368477b4c4..66ab4e683c40 100644 --- a/frontend/src/ts/test/test-logic.ts +++ b/frontend/src/ts/test/test-logic.ts @@ -12,6 +12,7 @@ import * as CustomText from "./custom-text"; import * as CustomTextState from "../states/custom-text-name"; import * as TestStats from "./test-stats"; import * as PractiseWords from "./practise-words"; +import * as SoundController from "../controllers/sound-controller"; import * as ShiftTracker from "./shift-tracker"; import * as AltTracker from "./alt-tracker"; import * as Focus from "./focus"; @@ -297,6 +298,7 @@ export function restart(options = {} as RestartOptions): void { TestUI.reset(); CompositionState.setComposing(false); CompositionState.setData(""); + void SoundController.clearAllSounds(); if (TestState.resultVisible) { if (Config.randomTheme !== "off") {