[4.7] fix issue #32962 [TablEdit import] string/fret assignments ignored in part 2 and up#32973
[4.7] fix issue #32962 [TablEdit import] string/fret assignments ignored in part 2 and up#32973Jojo-Schmitz wants to merge 1 commit intomusescore:4.7from
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughAdjusts TablEdit importer string indexing by introducing a Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/importexport/tabledit/internal/importtef.cpp (1)
256-267: 🧹 Nitpick | 🔵 TrivialDerive
stringIndexonce to avoid drift between pitch/string computations.The conversion formula is repeated in multiple places. Computing it once per note and passing it through reduces future mismatch risk.
♻️ Proposed refactor
-static void addNoteToChord(mu::engraving::Chord* chord, const TefNote* tefNote, int stringOffset, int pitch, muse::draw::Color color, +static void addNoteToChord(mu::engraving::Chord* chord, const TefNote* tefNote, int stringIndex, int pitch, muse::draw::Color color, std::vector<mu::engraving::Note*>& tiedNotes) { @@ - note->setString(tefNote->string - stringOffset - 1); + note->setString(stringIndex); @@ - for (const auto note : tefNotes) { - const auto stringOffset = stringNumberPreviousParts(part); + const int stringOffset = stringNumberPreviousParts(part); + for (const auto note : tefNotes) { + const int stringIndex = note->string - stringOffset - 1; // todo fix magical constant 96 and code duplication - int pitch = 96 - instrument.tuning.at(note->string - stringOffset - 1) + note->fret; + int pitch = 96 - instrument.tuning.at(stringIndex) + note->fret; LOGN(" -> string %d fret %d pitch %d", note->string, note->fret, pitch); // note TableEdit's strings start at 1, MuseScore's at 0 - addNoteToChord(chord, note, stringOffset, pitch, toColor(voice), tiedNotes); + addNoteToChord(chord, note, stringIndex, pitch, toColor(voice), tiedNotes); if (note->hasGrace) { // todo fix magical constant 96 and code duplication - int gracePitch = 96 - instrument.tuning.at(note->string - stringOffset - 1) + note->graceFret; - addGraceNotesToChord(chord, gracePitch, note->graceFret, note->string - stringOffset - 1, toColor(voice)); + int gracePitch = 96 - instrument.tuning.at(stringIndex) + note->graceFret; + addGraceNotesToChord(chord, gracePitch, note->graceFret, stringIndex, toColor(voice)); } }Also applies to: 437-447
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 17eae987-256c-4a1d-b22d-7b62b6b50be5
📒 Files selected for processing (5)
src/importexport/tabledit/internal/importtef.cppsrc/importexport/tabledit/tests/data/multi_track_frets.mscxsrc/importexport/tabledit/tests/data/multi_track_frets.tefsrc/importexport/tabledit/tests/data/time_signatures_2.mscxsrc/importexport/tabledit/tests/tabledit_tests.cpp
Refactoring is out of scope for a pure and plain backport |
…gnored in part 2 and up
Resolves: #32962
Backport of #32966
Summary by CodeRabbit
Bug Fixes
Tests