fix(spa): unmute restores previous volume instead of near-max (#207) - #258
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
min(20, castVolumeCap)fallback.Implementation
frontend/src/stores/player.ts:prevVolume/prevCastVolumestate +toggleMute()/toggleCastMute()actions.toggleCastMutereturns the new level soPlayerBarcan 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 itsdeviceIdguard, drag-timestamp update, andsonosSetVolumecall.Verification
pnpm verifygreen (hub + frontend suites, 142 frontend tests, typecheck, boundary lint).pnpm lintzero errors/warnings.🤖 Generated with Claude Code
https://claude.ai/code/session_01SwwPcrohddTUN7kmQVedQC