fix(cursor): advance on bass-only beats; make final beat reachable - #21
Merged
Conversation
_svBuildBeatTimeline walked only the first staff of the first track (breaking out of the loop right after staff 0), so any beat that only existed on the bass staff was absent from the tick index used for cursor sync — the cursor would stall or skip during left-hand-only passages. It now collects beats from all staves of the first track, sorts, and dedupes by tick, keeping the first (treble) entry when both staves share a position. _svSyncCursor's binary search bounded hi at beats.length - 2, which made the very last beat of a song unreachable by the search. Bound is now beats.length - 1. Co-Authored-By: Claude Sonnet <noreply@anthropic.com> Signed-off-by: gionnibgud <gionnibgud@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughStaffview cursor synchronization now includes beats from all staves, deduplicates shared ticks with treble precedence, and searches through the final beat. The changelog documents both fixes. ChangesStaffview cursor fixes
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
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.
Problem
The playback cursor only advanced on right-hand (treble) beats, and never reached the last beat of a song.
Two independent bugs in the tick index:
_svBuildBeatTimelinewalked only the first staff of the first track (break trackLoopright after staff 0). Beats that exist only on the bass staff were absent from the index used for cursor sync, so the cursor stalled or skipped through left-hand-only passages._svSyncCursor's binary search boundedhiatbeats.length - 2, making the final beat unreachable.Fix
_svBuildBeatTimelinenow collects beats from all staves of the first track, sorts, then dedupes by tick — the stable sort keeps the first (treble) entry where both staves share a position, preserving the existing preference.beats.length - 1._svBuildBeatTimelineupdated to match.Testing
npm test— 104/104 pass (unchanged from baseline; pure bugfix over already-covered helpers).🤖 Generated with Claude Code
Summary by CodeRabbit