fix: audio reliability — proper AudioContext resume, SFX destination, voice stability

- getSfxDest() helper centralizes SFX routing (replaces 38 inline calls)
- Await ensureAudioContext() before playing audio (fixes suspended context on prod)
- Chrome speechSynthesis pause bug workaround (periodic resume interval)
- Respect masterMuted on initial gain node creation
- Responsive overlay text sizes for small screens (text-2xl/5xl/7xl)
- Speech queue depth management with safety flush at depth > 3

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-07 22:46:47 +00:00
co-authored by Claude Opus 4.6
parent 07fa2cf35c
commit 20e9f0f7a2
3 changed files with 79 additions and 55 deletions
+4 -4
View File
@@ -268,7 +268,7 @@ async function initLiveScene() {
if (liveScene) {
if (liveSoundOn.value) {
ensureAudioContext()
await ensureAudioContext()
liveScene.startMusic()
}
announceDeepIntro()
@@ -517,9 +517,9 @@ async function handleFightEnd(data: any) {
if (pollHandle) { clearInterval(pollHandle); pollHandle = null }
}
function toggleLiveSound() {
async function toggleLiveSound() {
liveSoundOn.value = !liveSoundOn.value
ensureAudioContext()
await ensureAudioContext()
setMasterMute(!liveSoundOn.value)
}
@@ -829,7 +829,7 @@ function stopAutoBattle() {
<Transition name="announce">
<div v-if="liveAnnouncementVisible"
class="absolute inset-0 flex items-center justify-center pointer-events-none z-20">
<p class="font-funky text-5xl sm:text-7xl tracking-widest uppercase announce-text"
<p class="font-funky text-2xl sm:text-5xl lg:text-7xl tracking-widest uppercase announce-text"
:style="{ color: liveAnnouncementColor, textShadow: `0 0 20px ${liveAnnouncementColor}, 0 0 40px ${liveAnnouncementColor}` }">
{{ liveAnnouncement }}
</p>