Skip to content

Commit

Permalink
fix #297957: Ties extended in region after time signature change
Browse files Browse the repository at this point in the history
Resolves: https://musescore.org/en/node/297957.

When searching for a note to complete a tie, what matters is not so much that the note doesn't already have a tieBack(), but rather that the two notes have the same unisonIndex().
  • Loading branch information
mattmcclinch committed Dec 2, 2019
1 parent 3941e27 commit f6998a4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
5 changes: 1 addition & 4 deletions libmscore/note.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3127,10 +3127,7 @@ std::vector<Note*> Note::tiedNotes() const
int Note::unisonIndex() const
{
int index = 0;
auto notes = chord()->notes();
size_t ns = notes.size();
for (size_t i = 0; i < ns; ++i) {
Note* n = notes.at(i);
for (Note* n : chord()->notes()) {
if (n->pitch() == pitch()) {
if (n == this)
return index;
Expand Down
14 changes: 10 additions & 4 deletions libmscore/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,7 @@ Note* searchTieNote(Note* note)
// but err on the safe side in case there is roundoff in tick count
Fraction endTick = chord->tick() + chord->actualTicks() - Fraction(1, 4 * 480);

int idx1 = note->unisonIndex();
while ((seg = seg->next1(SegmentType::ChordRest))) {
// skip ahead to end of current note duration as calculated above
// but just in case, stop if we find element in current track
Expand All @@ -846,12 +847,17 @@ Note* searchTieNote(Note* note)
if (gn2)
return gn2;
}
int idx2 = 0;
for (Note* n : c->notes()) {
if (n->pitch() == note->pitch() && !n->tieBack()) {
if (note2 == 0 || c->track() == chord->track()) {
note2 = n;
break;
if (n->pitch() == note->pitch()) {
if (idx1 == idx2) {
if (note2 == 0 || c->track() == chord->track()) {
note2 = n;
break;
}
}
else
++idx2;
}
}
}
Expand Down

0 comments on commit f6998a4

Please sign in to comment.