Repository navigation
Add measure loop selection and persistent session state - #34
Merged
Merged
Conversation
Support click-drag measure range selection with visual highlight and loop the selected measures when starting playback with Space. Click without dragging still seeks without selecting, using a movement threshold to avoid accidental selection. Save and restore session fields in ~/.config/ruxguitar/config.json: last tab file, track, tempo, volume, cursor measure/beat, and measure selection. Auto-open the last tab on startup; reset tempo, volume, and position when the user opens a different GP file manually. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Owner
|
Thanks a lot for the contribution! I will play with the features and review it in the coming days. |
- send the events just before the loop end instead of dropping them - restore the loop start tempo on every pass - keep the loop in step with the selection while playing - resume in place when paused inside the loop - end the loop after the first pass of the last selected measure, and never build an empty range (unplayed alternative endings) - remember the canonical tab path so a relative CLI path still reopens - drop a pending startup restore when that load fails - save the session on window close before exiting Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The loop wrap lived in the audio callback, where no test reached it, and it dropped the time that ran past the loop end, so each pass restarted up to one audio buffer early. MidiSequencer::step now advances, plays what is left before the loop end, and restarts at the loop start carrying that overshoot, returning both event windows for the callback to play. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The loop range was built from the seek ticks, where a measure the playback never reaches (an unused alternative ending) borrows the tick of the measure before it, so a selection starting or ending on one looped the wrong measures. The range now uses each measure's first occurrence, skips unplayed measures at either edge, and takes the start tempo and the cursor jump from the first measure that really plays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The notes in the last buffer of a pass were started and released before the buffer was rendered, leaving only their release tail. The sequencer step now reports where in its time the loop end falls, and the callback renders up to that point before releasing the notes and starting the next pass, so the restart lands on the loop end within a synth block. Also clarify which repeats a measure loop includes, and drop an unused Default derive. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The selection fill was a fixed semi-transparent yellow that overpowered the notes and ignored the theme. It now blends a little of the theme's primary color into its background, like the string lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only the session as a whole defaulted when absent. A session saved before a field was added would fail to parse, and read_config would then reset the whole config, losing the tabs folder too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Thanks again! I took the liberty to fix some minor things, I will release soon 👍 |
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.
Summary
Thank you for ruxguitar — it’s an excellent, focused tab player: fast to open GP files, clear UI, and solid playback. For daily practice I was missing two things; this PR adds both.
Loop a measure range — drag to select measures (yellow highlight), press Space to loop only that section. A simple click still seeks without selecting (with a small drag threshold so clicks don’t turn into selection). Selection is shared across tracks when switching parts.
Persistent session — last opened GP path, track, tempo, master volume, playback position (measure/beat), and measure selection are saved under
~/.config/ruxguitar/config.jsonand restored on the next launch. Opening a different file manually resets tab-related settings to defaults; auto-reopen on startup still restores the previous session for the same file.Test plan
cargo testpasses locallyNotes
Playback loop uses the existing playback timeline (
measure_loop_tick_range/first_playback_ticks), not a separate MIDI rebuild.