diff --git a/frontend/src/game/sounds.ts b/frontend/src/game/sounds.ts index 852a780..81abe06 100644 --- a/frontend/src/game/sounds.ts +++ b/frontend/src/game/sounds.ts @@ -340,6 +340,14 @@ export function stopAllAudio() { stopMusic() if (typeof speechSynthesis !== 'undefined') speechSynthesis.cancel() _speechQueueDepth = 0 + // Disconnect sfxGain to instantly kill all in-flight oscillators/buffers, + // then reconnect so future sounds still work + if (sfxGain && ctx) { + sfxGain.disconnect() + sfxGain = ctx.createGain() + sfxGain.gain.value = masterMuted ? 0 : 0.25 + sfxGain.connect(ctx.destination) + } } // Public voice functions