Skip to content

Fix: fretboard grid derives string count from getStringCount(), not hardcoded 6 - #13

Merged
cchacs merged 4 commits into
mainfrom
claude/open-issues-todos-uj3tmu
Sep 10, 2026
Merged

cchacs merged 4 commits into
mainfrom
claude/open-issues-todos-uj3tmu

Conversation

@cchacs

@cchacs cchacs commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

FB_STRINGS = 6 was hardcoded, and chart note string indices were mapped straight onto that fixed 6-row grid. On a 4-string bass arrangement this put highlighted notes two rows off from where they're actually played (and the e/B/G/D/A/E labels don't apply to a bass at all); 7/8-string GP imports had the inverse problem — note string indices fell outside the fixed 6-row array entirely.

draw() now derives stringCount from highway.getStringCount() each frame (the same API keys_highway_3d and other consumers already document/use per the host's CLAUDE.md), falling back to 6 for a host too old to expose it, and uses it for all grid geometry, string colors (extended FB_STRING_COLORS/FB_STRING_BRIGHT to 8 entries for extended-range charts), and note-position mapping.

String names are only shown for tunings this plugin can name with confidence — standard 6-string guitar and 4-string bass. Other string counts (5-string bass, 7/8-string guitar, alternate tunings) fall back to numeric labels rather than guessing a wrong note name.

Closes got-feedBack#19

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Testing

  • Added unit tests for the two new pure helpers (_fbStringCount, _fbStringNames) covering: reading a valid count, falling back to 6 when getStringCount is missing/returns something non-positive-integer, and real vs. numeric-fallback name tables.
  • Added two draw()-level tests confirming it actually calls getStringCount() on the bound highway, and that it doesn't throw when the highway lacks the method (older host).
  • node tests/screen.test.js — 26/26 pass (was 18 before this change).

Repository Relevance

  • This change is relevant for this fork only — no upstream PR filed (I don't have access to got-feedBack/feedBack-plugin-fretboard, which the original issue references as the canonical repo; also filing a comment on get-flashbacks/feedBack#60, which vendors a copy of this plugin and tracks the same bug, once this merges).

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have not added comments beyond what was asked for
  • My changes generate no new warnings

🤖 Generated with Claude Code

https://claude.ai/code/session_016cfE1wg6F2VT6eqJEp4LBz


Generated by Claude Code

Struck chords used to fade out ~300ms after onset, and individual
member notes with shorter sustains would drop out before the rest of
the shape, leaving an incomplete-looking diagram. Chords are now held
together for a fixed 0.9s minimum, closing #2 and #3.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016cfE1wg6F2VT6eqJEp4LBz
CodeRabbit review finding on #12: the outer chord-visibility gate used
a flat `c.t >= t - CHORD_HOLD_S` check, so a chord onset more than
0.9s in the past was excluded entirely before the inner per-member
loop ever got a chance to see that one of its members had a longer
sus and should still be lit. E.g. a chord at t=0 with a sus:2 member
was gone by t=1.5 despite the member still sustaining.

Now computes the chord's actual end (max of CHORD_HOLD_S and every
member's sustain) and gates on that instead, so a long-sustain member
stays lit for its real duration while short members still get the
0.9s minimum hold.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016cfE1wg6F2VT6eqJEp4LBz
The overlay hardcoded a 6-string grid (FB_STRINGS = 6) and mapped chart
note string indices straight onto it. On a 4-string bass chart this put
highlighted notes two rows off from where they're actually played (and
the e/B/G/D/A/E labels don't apply to a bass); 7/8-string GP imports had
the inverse problem, with note string indices falling outside the fixed
6-row array entirely.

draw() now derives stringCount from highway.getStringCount() each frame
(falling back to 6 for a host too old to expose it) and uses it for all
grid geometry, string colors (extended to 8 entries), and note-position
mapping. String names are shown for the tunings this plugin can name
confidently (6-string guitar, 4-string bass); other counts fall back to
numeric labels rather than guessing a wrong note name.

Closes got-feedBack#19

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016cfE1wg6F2VT6eqJEp4LBz
@codereviewbot-ai

codereviewbot-ai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

LGTM! The dynamic string count detection, string name formatting, and chord hold sustain calculations are well implemented and backed by comprehensive unit tests.


🤖 Reviewed by codereviewbot.ai - Catch bugs before your team does.

…dos-uj3tmu

# Conflicts:
#	CHANGELOG.md
#	plugin.json
@codereviewbot-ai

codereviewbot-ai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

LGTM! The dynamic string count implementation cleanly resolves string index misalignment across different chart types (bass, standard guitar, extended-range) with robust fallbacks and solid test coverage.


🤖 Reviewed by codereviewbot.ai - Catch bugs before your team does.

@cchacs
cchacs merged commit 7b9201e into main Sep 10, 2026
3 of 4 checks passed
@cchacs
cchacs deleted the claude/open-issues-todos-uj3tmu branch September 10, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Overlay hardcodes 6 strings — notes misaligned on bass/7-string charts

2 participants