fix(app): let a sound restart immediately after being stopped (#1960)

This commit is contained in:
Hampus authored and GitHub committed 2026-08-24 12:53:34 +02:00
1 parent 38a299d852
commit 38e86acffe
1 file changed
+1 -1
@@ -499,6 +499,7 @@ export function clearCustomSoundCache(type?: SoundType): void {
export async function stopSound(type: SoundType): Promise<void> { export async function stopSound(type: SoundType): Promise<void> {
const activeSound = activeSounds.get(type); const activeSound = activeSounds.get(type);
if (!activeSound) return; if (!activeSound) return;
activeSounds.delete(type);
const {audio, gainNode, sourceNode} = activeSound; const {audio, gainNode, sourceNode} = activeSound;
try { try {
await fadeOut(gainNode, 0.08); await fadeOut(gainNode, 0.08);
@@ -507,7 +508,6 @@ export async function stopSound(type: SoundType): Promise<void> {
audio.currentTime = 0; audio.currentTime = 0;
audio.loop = false; audio.loop = false;
disconnectNodes(sourceNode, gainNode); disconnectNodes(sourceNode, gainNode);
activeSounds.delete(type);
} }
export async function stopAllSounds(): Promise<void> { export async function stopAllSounds(): Promise<void> {