mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-08-11 03:09:57 +00:00
fix(gp-import): correct bass string count, lead/rhythm roles, preview note count (#601)
Four tester-reported GP-import issues, all in the converter/parse layer: * String count (bugs 2 & 4): <tuning> is padded to 6 slots, so a 4-string bass, 5-string bass and 6-string guitar were byte-identical and the real count was lost — a 5-string bass played on 4 strings and a 4-string bass showed a phantom B in the editor. Record the authoritative count in a new <tuning stringCount=N> attribute (gp2rs._build_xml) and trim the padded tail back to it on read (song.parse_arrangement). All consumers already trust a non-6 tuning length (arrangement_string_count, the editor's _stringCountFor and build-time _normalize_tuning_to_count), so this fixes the create-mode preview AND the built sloppak with no consumer changes. * Lead/Rhythm reversed (bug 3): guitar arrangements were named by appearance order (first guitar -> Lead), swapping roles for files that list Rhythm before Lead. Honor 'lead'/'rhythm' in the GP track name; unhinted tracks keep positional fallback. Applied to both convert_file's fallback (the editor's track_indices-without-names path) and _auto_select_gpx, with cross-role dedup so name-based and positional labels can't collide. * Preview note count (bug 1): the importer's per-track count included tie-continuation notes, which are folded into the previous note's sustain and never become separate RS notes (260 shown vs 241 imported). Exclude tie destinations so the preview matches the imported result. Adds regression tests for all three. Bug 5 (no stems from synced audio) is environment-dependent (best-effort demucs backend) and not addressed here. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
13bbfc0b3d
commit
c8e0ad3f75
@@ -1124,7 +1124,17 @@ def _build_xml(
|
||||
# for compatibility, and emit additional string6+ attributes (up to
|
||||
# `len(tuning)-1`) for 7+ string arrangements. FeedBack parses
|
||||
# them; the format ignores them.
|
||||
#
|
||||
# `stringCount` records the AUTHORITATIVE string count (== len(tuning)),
|
||||
# because the 6-slot padding above erases the 4-vs-5-vs-6-string
|
||||
# distinction for standard tunings (a 4-string bass, 5-string bass and
|
||||
# 6-string guitar are otherwise byte-identical, all string0..5 = 0).
|
||||
# parse_arrangement trims `tuning` back to this on read so downstream
|
||||
# string-count derivation (song.arrangement_string_count, the editor's
|
||||
# _stringCountFor) sees the real width instead of guessing. RS2014 and
|
||||
# any other consumer simply ignore the unknown attribute.
|
||||
tuning_el = ET.SubElement(root, "tuning")
|
||||
tuning_el.set("stringCount", str(len(tuning)))
|
||||
for i in range(max(6, len(tuning))):
|
||||
tuning_el.set(f"string{i}", str(tuning[i] if i < len(tuning) else 0))
|
||||
ET.SubElement(root, "capo").text = "0"
|
||||
|
||||
Reference in New Issue
Block a user