Skip to content

fix(spa): unmute restores previous volume instead of near-max (#207) - #258

Merged
benders merged 2 commits into
mainfrom
feature/207-unmute-volume
Jul 13, 2026
Merged

fix(spa): unmute restores previous volume instead of near-max (#207)#258
benders merged 2 commits into
mainfrom
feature/207-unmute-volume

Conversation

@benders

@benders benders commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Closes #207.

Clicking the speaker icon to unmute set local volume to raw 0.8, which the square-law volume slider (position = sqrt(volume)) renders at ~90% — the "nearly max" from the issue.

Behavior

  • Muting via the speaker button remembers the current level (session-scoped, not persisted); unmuting restores it.
  • No remembered level (fresh session, or slider dragged to 0 manually): local audio unmutes to halfway slider position (raw 0.25 under the square law); Sonos cast keeps the pre-existing min(20, castVolumeCap) fallback.
  • A restored cast level is clamped to the current cap (the cap may have changed while muted). Unmute never lands on 0.

Implementation

  • frontend/src/stores/player.ts: prevVolume/prevCastVolume state + toggleMute() / toggleCastMute() actions. toggleCastMute returns the new level so PlayerBar can push it to the Sonos device — the store doesn't own that side effect.
  • PlayerBar.tsx: both speaker buttons call the store actions; Sonos branch keeps its deviceId guard, drag-timestamp update, and sonosSetVolume call.
  • 9 new store tests (player.test.ts 19 → 28).

Verification

  • pnpm verify green (hub + frontend suites, 142 frontend tests, typecheck, boundary lint).
  • pnpm lint zero errors/warnings.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SwwPcrohddTUN7kmQVedQC

claude added 2 commits July 13, 2026 09:19
…207)

The speaker button unmuted local audio to raw 0.8, which the square-law
slider renders at ~90% — nearly max. Mute now remembers the pre-mute
level in the player store and unmute restores it, falling back to
halfway slider position (raw 0.25). Sonos cast volume gets the same
remember/restore, clamped to the current cap, keeping the min(20, cap)
fallback. Unmute never lands on 0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SwwPcrohddTUN7kmQVedQC
#207)

Component-level tests that drive the actual Mute/Unmute buttons: local
restore + halfway fallback, and cast mute/unmute pushing to the Sonos
device. Test-style credit to PR #259.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SwwPcrohddTUN7kmQVedQC
@benders
benders marked this pull request as ready for review July 13, 2026 22:47
@benders
benders merged commit 442e7b8 into main Jul 13, 2026
2 checks passed
@benders
benders deleted the feature/207-unmute-volume branch July 21, 2026 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clicking volume "speaker" icon when volume is at zero should set it low

2 participants