Skip to content

Commit

Permalink
ENG-58: Another small melisma fix
Browse files Browse the repository at this point in the history
This fixes another track-related oversight in importing melisma lines
that caused some (particularly those ending on rests) to be occasionally
omitted.

Duplicate of musescore#8461, part 3
  • Loading branch information
iveshenry18 authored and Jojo-Schmitz committed Aug 19, 2021
1 parent 6991266 commit f271408
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions importexport/musicxml/importmxmlpass2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,19 @@ void MusicXmlLyricsExtend::addLyric(Lyrics* const lyric)
// lastChordTicks
//---------------------------------------------------------

// find the duration of the chord starting at or after s in track and ending at tick
// find the duration of the chord starting at or after s and ending at tick

static Fraction lastChordTicks(const Segment* s, const int track, const Fraction& tick)
static Fraction lastChordTicks(const Segment* s, const Fraction& tick)
{
while (s && s->tick() < tick) {
Element* el = s->element(track);
if (el && el->isChordRest()) {
ChordRest* cr = static_cast<ChordRest*>(el);
if (cr->tick() + cr->actualTicks() == tick)
return cr->actualTicks();
for (Element* el : s->elist()) {
if (el && el->isChordRest()) {
ChordRest* cr = static_cast<ChordRest*>(el);
if (cr->tick() + cr->actualTicks() == tick)
return cr->actualTicks();
}
}
s = s->nextCR(track, true);
s = s->nextCR(-1, true);
}
return Fraction(0,1);
}
Expand All @@ -163,7 +164,7 @@ void MusicXmlLyricsExtend::setExtend(const int no, const int track, const Fracti
ChordRest* const par = static_cast<ChordRest*>(el);
if ((no == -1 && par->track() == track)
|| (l->no() == no && track2staff(par->track()) == track2staff(track))) {
Fraction lct = lastChordTicks(l->segment(), track, tick);
Fraction lct = lastChordTicks(l->segment(), tick);
if (lct > Fraction(0,1)) {
// set lyric tick to the total length from the lyric note
// plus all notes covered by the melisma minus the last note length
Expand Down

0 comments on commit f271408

Please sign in to comment.