Skip to content

Commit 05af414

Browse files
committed
Clear all sounds on test finish
1 parent 8cce5bf commit 05af414

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

frontend/src/ts/controllers/sound-controller.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,11 @@ export async function playTimeWarning(): Promise<void> {
638638
soundToPlay.play();
639639
}
640640

641+
export async function clearAllSounds(): Promise<void> {
642+
const Howl = (await gethowler()).Howler;
643+
Howl.stop();
644+
}
645+
641646
function playNote(
642647
codeOverride?: string,
643648
oscillatorTypeOverride?: SupportedOscillatorTypes,

frontend/src/ts/test/test-logic.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import * as CustomText from "./custom-text";
1212
import * as CustomTextState from "../states/custom-text-name";
1313
import * as TestStats from "./test-stats";
1414
import * as PractiseWords from "./practise-words";
15+
import * as SoundController from "../controllers/sound-controller";
1516
import * as ShiftTracker from "./shift-tracker";
1617
import * as AltTracker from "./alt-tracker";
1718
import * as Focus from "./focus";
@@ -297,6 +298,7 @@ export function restart(options = {} as RestartOptions): void {
297298
TestUI.reset();
298299
CompositionState.setComposing(false);
299300
CompositionState.setData("");
301+
void SoundController.clearAllSounds();
300302

301303
if (TestState.resultVisible) {
302304
if (Config.randomTheme !== "off") {

0 commit comments

Comments
 (0)