From cdf74e2999ab412e8effe42416df0ebc217187d5 Mon Sep 17 00:00:00 2001 From: kts of kettek Date: Sun, 30 Jan 2022 05:02:28 -0800 Subject: [PATCH] Add stopSong --- Engine/src/shared/audio.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Engine/src/shared/audio.ts b/Engine/src/shared/audio.ts index dab061b..9b43653 100644 --- a/Engine/src/shared/audio.ts +++ b/Engine/src/shared/audio.ts @@ -90,6 +90,12 @@ export function playSong(name: string) { } } +export function stopSong() { + if (playingSongAudio && !playingSongAudio.paused) { + playingSongAudio.pause() + } +} + export function playSound(name: string, volume: number): HTMLAudioElement|undefined { if (!enabled) return let s = audioCache.pop()