Repository navigation
Let the player withdraw the server's volume and mute commands - #203
Merged
Merged
Conversation
Adds PlayerRole::set_volume_adjustable() and set_mute_adjustable(), enabled by default. While one is disabled, its command leaves client/state supported_commands, its value is omitted, and a server command for it is ignored; the stored value is kept. The spec lets a player change supported_commands mid-session, so no reconnect is needed. The basic and TUI examples gain -F (the server cannot set the volume, which starts at full scale) and -M (the server cannot set mute). Closes #82.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The central runtime publication behavior lacks effective coverage, and a new test unnecessarily bypasses the public API.
2 open findings
What changed in this PR
Adds runtime controls for withdrawing server volume and mute commands without reconnecting.
Changes:
- Adds volume/mute adjustability APIs and conditional state serialization.
- Ignores withdrawn commands while preserving local values.
- Updates tests, documentation, and example CLI flags.
| File | Description |
|---|---|
include/sendspin/player_role.h |
Declares and documents new setters. |
src/player_role.cpp |
Implements flags, state reporting, and command guards. |
src/player_role_impl.h |
Stores adjustability flags. |
src/protocol_messages.h |
Makes volume and mute optional. |
src/protocol.cpp |
Omits unset fields during serialization. |
tests/test_player_role.cpp |
Tests capabilities and ignored commands. |
tests/test_protocol.cpp |
Tests optional-field serialization. |
docs/integration-guide.md |
Documents runtime controls. |
examples/basic_client/main.cpp |
Adds -F and -M options. |
examples/basic_client/README.md |
Documents new options. |
examples/tui_client/main.cpp |
Adds -F and -M options. |
examples/tui_client/README.md |
Documents new options. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The command-gate test now builds the role with add_player() and sets and reads it through the public setters and getters. A new loopback test checks that withdrawing and restoring volume and mute republishes client/state while connected; dropping either setter's publish hangs it. The player test's access comment now names PlayerRole::impl_.
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.


Lets a player withdraw the server's volume and mute commands at runtime, for outputs whose level is set elsewhere (e.g. line out to an amplifier). The current spec carries
supported_commandsinclient/stateand lets a player change it mid-session (roles/player/v1.md "client/state player object"), so no reconnect is needed.Closes #82.
Change
PlayerRole::set_volume_adjustable(bool)andset_mute_adjustable(bool), main loop only, both enabled by default, mirroringset_output_delay_adjustable(). The flags are not persisted.supported_commands, itsvolume/mutedvalue is omitted fromclient/state, and a server command for it is ignored. The stored value is kept and reported again when re-enabled.ClientPlayerStateObject::volume/mutedbecomestd::optional; the formatter writes them only when set.basic_clientandtui_clientgain-F(the server cannot set the volume, which starts at 100) and-M(the server cannot set mute). Local volume and mute controls still work.docs/integration-guide.mddocuments the setters.Notes
Tests
supported_commands, presence ofvolume/muted, the defaults, and a disable/re-enable row.client/statewhile connected; dropping either setter's publish hangs it.