Skip to content

Commit c5ac9d6

Browse files
lvinkenJojo-Schmitz
authored andcommitted
fix issue #32962 [TablEdit import] string/fret assignments ignored in part 2 and up
1 parent 1a13659 commit c5ac9d6

File tree

5 files changed

+520
-9
lines changed

5 files changed

+520
-9
lines changed

src/importexport/tabledit/internal/importtef.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ static String fingeringTextRH(int rightFinger)
253253
}
254254
}
255255

256-
static void addNoteToChord(mu::engraving::Chord* chord, const TefNote* tefNote, int pitch, muse::draw::Color color,
256+
static void addNoteToChord(mu::engraving::Chord* chord, const TefNote* tefNote, int stringOffset, int pitch, muse::draw::Color color,
257257
std::vector<mu::engraving::Note*>& tiedNotes)
258258
{
259259
LOGN("pitch %d", pitch);
@@ -263,7 +263,7 @@ static void addNoteToChord(mu::engraving::Chord* chord, const TefNote* tefNote,
263263
note->setPitch(pitch);
264264
note->setTpcFromPitch(Prefer::NEAREST);
265265
note->setFret(tefNote->fret);
266-
note->setString(tefNote->string - 1);
266+
note->setString(tefNote->string - stringOffset - 1);
267267
note->setColor(color);
268268
if (tefNote->tie) {
269269
tiedNotes.push_back(note);
@@ -440,11 +440,11 @@ void TablEdit::createContents(const MeasureHandler& measureHandler)
440440
int pitch = 96 - instrument.tuning.at(note->string - stringOffset - 1) + note->fret;
441441
LOGN(" -> string %d fret %d pitch %d", note->string, note->fret, pitch);
442442
// note TableEdit's strings start at 1, MuseScore's at 0
443-
addNoteToChord(chord, note, pitch, toColor(voice), tiedNotes);
443+
addNoteToChord(chord, note, stringOffset, pitch, toColor(voice), tiedNotes);
444444
if (note->hasGrace) {
445445
// todo fix magical constant 96 and code duplication
446-
int gracePitch = 96 - instrument.tuning.at(/* todo */ note->string - stringOffset - 1) + note->graceFret;
447-
addGraceNotesToChord(chord, gracePitch, note->graceFret, /* todo */ note->string - 1, toColor(voice));
446+
int gracePitch = 96 - instrument.tuning.at(note->string - stringOffset - 1) + note->graceFret;
447+
addGraceNotesToChord(chord, gracePitch, note->graceFret, note->string - stringOffset - 1, toColor(voice));
448448
}
449449
}
450450
tupletHandler.addCr(measure, chord);

0 commit comments

Comments
 (0)