Give the menus a theme

background-music.wav loops under the title screen and the court picker, ducks
out when a court is picked, and fades back in at the death summary — the end
screen is a menu too, so the zombie bed ducks out as this one comes in.

It starts at BOOT, not on the first tap, so the title screen already has music.
That needed loopBed to call audio() before its already-started early return: the
theme plays into a context the autoplay policy holds suspended, and the call
that wakes it is a second menuMusic() from the first tap, which used to return
at the beds.has guard without reaching AC.resume().

fadeBed also now records a duck for a bed that is still loading, and loopBed
starts that bed silent. An 8 MB file ducked mid-fetch would otherwise come up at
full level, seconds later, over the match. Same latent bug applied to zombieDuck.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
wuwiandClaude Opus 5 committed 2026-08-01 10:42:10 +02:00
1 parent fa30fb94c4
commit 60a74f6a99
6 files changed
+51 -8

No files matched your search

+16
View File
@@ -442,6 +442,22 @@ Three courts, picked on a second start-screen stage. A court is pure DATA — `C
Not done: clay ball-marks (the `gore` decal loop already draws flat ground ellipses, so a pale
scuff per bounce is one call), per-court bounce SOUND, per-court crowd density.
**Menu theme** (`background-music.wav`, `menuMusic`/`menuDuck` in audio.js). Started at BOOT so the
title screen has music, ducked out when a court is picked, faded back in at `EATEN_SUMMARY` — the
death summary is the end menu, and the zombie bed ducks out as it comes in. Two things this cost:
- `loopBed` now calls `audio()` BEFORE its already-started early return. The theme starts before any
gesture exists, so on a phone it plays into a context the autoplay policy holds suspended; the
call that wakes it is a second `menuMusic()` from the first tap, and that used to return at the
`beds.has` guard without ever reaching the `AC.resume()` inside `audio()`.
- `fadeBed` records a duck for a bed that is STILL LOADING (`ducked`), and `loopBed` starts that
bed's gain at 0. Without it, a multi-megabyte file ducked mid-fetch comes up at full level several
seconds later, over the match.
`background-music.wav` is 8.3 MB and now downloads on every page load. Converting it to m4a (as the
umpire lines already are) would cut that ~10x; `loopBed` hardcodes `.wav`, so that is a two-line
change if it ever matters.
## Session log: the serve is the gesture (2026-08-01)
Oliver's notes on the art pass: the zombies are good, the runner "flickers very hard", and the