Skip to content

Commit

Permalink
fix #282099: backwards melisma with overlapping voices
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcSabatella committed Apr 22, 2019
1 parent e6eb405 commit e6743f9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
2 changes: 2 additions & 0 deletions libmscore/lyricsline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ void LyricsLine::layout()
}
lyrics()->undoChangeProperty(Pid::LYRIC_TICKS, ps->tick() - lyricsStartTick);
}
// Spanner::computeEndElement() will actually ignore this value and use the (earlier) lyrics()->endTick() instead
// still, for consistency with other lines, we should set the ticks for this to the computed (later) value
setTicks(s->tick() - lyricsStartTick);
}
else { // dash(es)
Expand Down
27 changes: 25 additions & 2 deletions libmscore/spanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "measure.h"
#include "undo.h"
#include "staff.h"
#include "lyrics.h"
#include "musescoreCore.h"

namespace Ms {
Expand Down Expand Up @@ -596,13 +597,35 @@ void Spanner::computeEndElement()
setTrack2(track());
if (ticks().isZero() && isTextLine() && parent()) // special case palette
setTicks(score()->lastSegment()->tick() - _tick);
// find last cr on this staff that ends before tick2

_endElement = score()->findCRinStaff(tick2(), track2() / VOICES);
if (isLyricsLine()) {
// lyrics endTick should already indicate the segment we want
// except for TEMP_MELISMA_TICKS case
Lyrics* l = toLyricsLine(this)->lyrics();
Fraction tick = (l->ticks().ticks() == Lyrics::TEMP_MELISMA_TICKS) ? l->tick() : l->endTick();
Segment* s = score()->tick2segment(tick, true, SegmentType::ChordRest);
if (!s) {
qDebug("%s no end segment for tick %d", name(), tick);
return;
}
int t = trackZeroVoice(track2());
// take the first chordrest we can find;
// linePos will substitute one in current voice if available
for (int v = 0; v < VOICES; ++v) {
_endElement = s->element(t + v);
if (_endElement)
break;
}
}
else {
// find last cr on this staff that ends before tick2
_endElement = score()->findCRinStaff(tick2(), track2() / VOICES);
}
if (!_endElement) {
qDebug("%s no end element for tick %d", name(), tick2().ticks());
return;
}

if (!endCR()->measure()->isMMRest()) {
ChordRest* cr = endCR();
Fraction nticks = cr->tick() + cr->actualTicks() - _tick;
Expand Down

0 comments on commit e6743f9

Please sign in to comment.