Files
Dune/docs/TABLE_SOUNDS.md
T
Quintine bfa24b0c4a Add optional local table sound controls
Connect browser-local mute, keyboard volume and a test sample with short original Web Audio cues for public phase/status/turn changes and tagged automatic actions. Audio consumes only projected sequences and public phase identity, with no game actions, private eligibility checks, media requests or saved-game writes. Preferences default off at 35%, survive refresh and synchronize across same-origin tabs.

Silent initial snapshots, stale sequence rejection, batch priority and a 700ms cooldown avoid historical replay and queued bursts. User gestures unlock audio; hidden tabs stay silent. Mute, backgrounding and unmount stop active voices, pending unlocks are cancelled, and unavailable audio remains cosmetic. Existing automatic visual notices and AI pacing remain independent.

Six focused regressions cover cursor consumption, phase priority, room changes, bounded volume and voices, unlock cancellation, disposal, unavailable audio and accessible initial controls. Independent review found a mobile panel overflow; the corrected panel stayed inside the viewport in DOM measurements. Browser controls verified enable/mute, keyboard volume, zero-volume disabling, refresh restoration and cross-tab preference updates. Preferences were restored to off/35%. Physical output and screenshot acceptance remain unverified because screenshot capture timed out. Broader event coverage and final sound design remain unfinished.

Types, lint and 4856 offline tests plus production build pass on the unchanged source fingerprint below. The first broad check found the accessibility linter's semantic-output requirement; the status element was corrected before the final checks. HTTP/AI calibration runs were not repeated for this cosmetic-only change.

All 1,072 saved games, 2,243 seats and original recovery/entry/handover records match the pre-outage backup; SQLite quick-check and foreign keys pass. The responding server and isolated browser seat were reused after the latest outage, without resetting games or creating automation. Mode and publication gates remain closed.

Verified source tree: da84d2cc4ed5b0face56afb034857b85c52708e11d86ff3f1cb3c8abdeee99d0
2026-09-20 11:15:43 +10:00

2.7 KiB

Optional table sounds

The connected sound prototype adds browser-local mute, volume and a test control to the table header. It defaults to off at 35% volume. Settings are independent of automatic visual notices and synchronize between tabs on the same origin. Storage failure retains the preference in memory without interrupting play.

Two original sine-tone cues are synthesized with Web Audio: one for a new tagged automatic action and two for a phase/status/turn transition. Audio uses only the existing projected log sequences and public phase identity. It does not inspect cards, plans, private resources, pending eligibility or other seats. It sends no actions and changes neither rules, AI pacing nor persistent game state. No audio download, external service or microphone permission is required.

Initial/restored snapshots establish a silent baseline. Later snapshots are consumed even when muted, hidden or unable to play. A batch produces at most one cue, phase changes take precedence, and a 700ms minimum interval drops rapid cues without keeping a backlog. Log truncation and stale sequences do not replay automatic events. Switching rooms establishes a fresh baseline.

Audio is unlocked only by a user gesture. A saved enabled preference needs a click or key press after refresh before new cues can sound. Enable and Test sound offer a sample. Volume zero is silent and disables Test sound. Mute, backgrounding and unmount stop active tones; unmount closes the context. Failed/unsupported audio remains cosmetic; a failed explicit preview reports that play can continue. Audio is independent of reduced-motion settings.

Evidence and limits

tests/table-sound.test.tsx checks initial/stale/duplicate snapshots, room changes, silent consumption, coalescing, priority, bounded volume and voice duration, gesture-only context creation, pending unlock cancellation, mute/disposal, unavailable audio and accessible initial controls. Its fake audio context does not prove physical speaker output or every browser's autoplay policy.

Browser verification covers the existing isolated saved seat, sound on/off, keyboard volume, zero-volume test disabling, refresh persistence and same-origin tab synchronization. The phone panel's bounds were checked at a 390px requested viewport. Screenshot capture timed out, so this checkpoint does not claim visual screenshot acceptance or audible output verification. No game action was needed to change sound settings. Settings were returned to off and 35% afterward.

This is a functional prototype, not the final sound design. Successful powers without an automatic notice tag remain outside these cues. Per-component audio, broader device/browser acceptance and final sound mixing remain unfinished.