Repository navigation
Move repeat and shuffle states to controller state - #81
Conversation
|
Metadata describes what is playing. Controller describes how it is playing. |
Makes sense! At least more sense than what it was before. The only other consistent alternative I can think of that is putting everything into the |
|
I agree, this is the right way to approach, I think previously the spec awkwardly tried to keep the controller role mostly focused on the command behavior, and less about getting data back from the Server. There isn't a reason that existing split should be continued imho. We do need to update the spec + website though, to match. |
|
Thanks!
I didn't see a great spot for adding that to the spec in general, we don't really have a pattern for the "why" questions in the spec itself. Maybe we should consider adding some supplemental document that we can update that has more context on how/why we made certain decisions. @chrisuthe Would you mind handling the website update? I think there are now a few things out of date (a couple weeks ago didn't we discuss that the pause state was still there? Maybe that's been fixed though) |
Breaking change! Moves repeat and shuffle status from the metadata state to the controller state to match the latest spec: Sendspin/spec#81
After [Sendspin/spec#81](Sendspin/spec#81), `repeat` and `shuffle` now belong to the state object of the controller role instead of the metadata role. For now the existing `metadata.repeat` / `metadata.shuffle` are kept for backwards compatibility with clients that haven't moved to the new format yet. This will be removed in a future PR. # Breaking changes * `MetadataGroupRole.update(repeat=...)` / `update(shuffle=...)` no longer exist. Use `ControllerGroupRole.set_repeat` / `set_shuffle` instead. * `ControllerStatePayload` requires `repeat` and `shuffle` when constructed directly.
#4042) Implements the `visualizer@v1` role on the Sendspin server and updates Music Assistant to aiosendspin 6.0.1. The older `visualizer@_draft_r1` role is left unchanged and still carries no beats. Clients connecting with the `visualizer@_draft_r1` role still remain fully functional. ## Visualizer The Sendspin player derives a per-track beat schedule from `smart_fades` analysis and streams it to visualizer clients over `visualizer@v1`. The Hue Entertainment plugin is reworked to use the v1 role, including beat-based colour cycling with selectable modes. Older clients using `visualizer@_draft_r1` stay fully compatible after this PR. ## Player timing Reports each player's lead-time and live-source hints to the push stream so it schedules the first chunk far enough ahead. This stops the AirPlay bridge from cutting off the start of a track. Older clients not implementing this stay fully compatible after this PR. ## Repeat and shuffle Repeat and shuffle now ride on controller state, following the aiosendspin 6.0 move off metadata. The server sets the controller state and keeps the legacy metadata copy in sync so older and newer clients both work. ## Known limitations The Hue plugin's beat effects need the track's beat analysis. On the first play of a track whose analysis has not been computed yet, the lights use the peak and onset fallback for the first stretch (up to ~30s) until beats arrive. During a smart-fades transition the beats of the crossfading tracks are used as is and can drift slightly while the two tracks overlap. Alignment is correct again once the transition completes. The Hue bridge uses a small visualizer buffer for near-realtime delivery, so after a track change beats take a few seconds to start arriving (the first moments of the new schedule are kept near the playhead and not delivered yet). The lights use the peak and onset fallback until they do. Beat data is loaded by a lightweight retry poller rather than an audio-analysis event subscription. This is intentional, to keep the changes contained to the Sendspin provider and avoid touching core Music Assistant code before the 2.9 release. Visualizer pitch detection is disabled server-wide for now. It is the heaviest visualizer DSP and its result quality is still mixed, so it needs more testing before being enabled. ## Relevant Specification this PR implements - Sendspin/spec#86 - Sendspin/spec#69 - Sendspin/spec#81 ## Testing I tested this locally, on a Raspberry Pi 4, and a Home Assistant Green. Lower powered clients may not be powerful enough to compute `beats` in time, but the Hue bridge falls back to `peaks` if thats the case.
#4042) Implements the `visualizer@v1` role on the Sendspin server and updates Music Assistant to aiosendspin 6.0.1. The older `visualizer@_draft_r1` role is left unchanged and still carries no beats. Clients connecting with the `visualizer@_draft_r1` role still remain fully functional. ## Visualizer The Sendspin player derives a per-track beat schedule from `smart_fades` analysis and streams it to visualizer clients over `visualizer@v1`. The Hue Entertainment plugin is reworked to use the v1 role, including beat-based colour cycling with selectable modes. Older clients using `visualizer@_draft_r1` stay fully compatible after this PR. ## Player timing Reports each player's lead-time and live-source hints to the push stream so it schedules the first chunk far enough ahead. This stops the AirPlay bridge from cutting off the start of a track. Older clients not implementing this stay fully compatible after this PR. ## Repeat and shuffle Repeat and shuffle now ride on controller state, following the aiosendspin 6.0 move off metadata. The server sets the controller state and keeps the legacy metadata copy in sync so older and newer clients both work. ## Known limitations The Hue plugin's beat effects need the track's beat analysis. On the first play of a track whose analysis has not been computed yet, the lights use the peak and onset fallback for the first stretch (up to ~30s) until beats arrive. During a smart-fades transition the beats of the crossfading tracks are used as is and can drift slightly while the two tracks overlap. Alignment is correct again once the transition completes. The Hue bridge uses a small visualizer buffer for near-realtime delivery, so after a track change beats take a few seconds to start arriving (the first moments of the new schedule are kept near the playhead and not delivered yet). The lights use the peak and onset fallback until they do. Beat data is loaded by a lightweight retry poller rather than an audio-analysis event subscription. This is intentional, to keep the changes contained to the Sendspin provider and avoid touching core Music Assistant code before the 2.9 release. Visualizer pitch detection is disabled server-wide for now. It is the heaviest visualizer DSP and its result quality is still mixed, so it needs more testing before being enabled. ## Relevant Specification this PR implements - Sendspin/spec#86 - Sendspin/spec#69 - Sendspin/spec#81 ## Testing I tested this locally, on a Raspberry Pi 4, and a Home Assistant Green. Lower powered clients may not be powerful enough to compute `beats` in time, but the Hue bridge falls back to `peaks` if thats the case.
# What does this implement/fix? <!-- Quick description and explanation of changes. --> Since #408, the server no longer copies `repeat` and `shuffle` into the metadata object, so clients that still read them there lose both. This affects sendspin-cli, Sendspin-TUI and SendspinKit, and the sendspin-cli TUI shows no repeat or shuffle state against a 10.0.0 server. Legacy clients (unencrypted, or sending `trust_level` or player `supported_commands` in their hello) now get both fields in metadata again, and metadata is resent to them when either changes. Current clients still only get them in the controller object. **Related issue or spec PR (if applicable):** - Sendspin/spec#81 ## Types of changes <!-- Tick exactly one box. CI (.github/workflows/pr-labels.yaml) applies the matching label, and the release notes use it to sort this change. --> - [x] Bugfix (non-breaking change which fixes an issue): `bugfix` - [ ] New feature (non-breaking change which adds functionality): `new-feature` - [ ] Enhancement to an existing feature: `enhancement` - [ ] Breaking change (changes the public API or the protocol in a way that is not backwards compatible): `breaking-change` - [ ] Refactor (no behavior change): `refactor` - [ ] Documentation only: `documentation` - [ ] Maintenance / chore: `maintenance` - [ ] CI / workflow change: `ci` - [ ] Dependencies bump: `dependencies`
These two states seem out of place for the metadata role, as they don't describe more textual details about the current playing audio. They do describe how the audio will playback (much like how volume and mute states describe it), and they are group wide settings. This PR moves those two fields to the controller state and makes them always required fields.