Repository navigation
fix(desktop): hold a playback anchor so lyric lines land on the beat - #10
Merged
Merged
Conversation
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.
Lyric lines arrived early on one verse and late on the next.
Players are not obliged to keep the position they publish up to date. MPRIS
has clients assume playback advances linearly and watch for a discontinuity
instead, and several players round the value or leave it standing between
updates. Reprise was adopting every sample as the new truth, which handed
the player's rounding straight to the lyric sheet twice a second.
Now the position advances on the clock from an anchor, and a sample only
replaces it when playback has genuinely moved: a new track, a change of
state, or a jump beyond the drift tolerance. A seek is still picked up on
the very next poll.
Simulated against a player reporting whole-second positions, polled every
500ms, over a 40-line sheet:
The remaining 200ms is the panel's own 250ms tick, which macOS shares. For a
player that reports precise positions the two are identical, so the change
costs nothing where it was not needed.
Also here:
the midpoint of the round trip. A shared timestamp taken before the reads
ran the estimate ahead by however long they took, and an anchor holds that
error for the length of a track.
PlaybackPosition.Projectsplits the unclamped projection out ofEstimate, because asking whether playback has jumped is not a questionabout the track's length: a length that has not arrived yet clamped the
comparison to zero and re-anchored on every poll.
observed. Every candidate comes from one sweep, so that key now only
favoured whichever player answered last, taking the choice away from the
player id that keeps the panel from flickering.
https://claude.ai/code/session_0164R7Zuagx737iKYbuuSjnA