Skip to content

Commit

Permalink
fix #62341: transpose chords on staff transposition change
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcSabatella committed Oct 30, 2015
1 parent d45cc19 commit f8a0b29
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions libmscore/transpose.cpp
Expand Up @@ -665,15 +665,13 @@ void Score::transpositionChanged(Part* part, Interval oldV, int tickStart, int t
{
Interval v = part->instrument(tickStart)->transpose();
v.flip();
Interval diffV(oldV.chromatic + v.chromatic);

// transpose keys first
if (!styleB(StyleIdx::concertPitch)) {
Interval diffV(oldV.chromatic + v.chromatic);
//int tickEnd = lastSegment() ? lastSegment()->tick() : 0;
if (!styleB(StyleIdx::concertPitch))
transposeKeys(part->startTrack() / VOICES, part->endTrack() / VOICES, tickStart, tickEnd, diffV);
}

// now transpose notes
// now transpose notes and chord symbols
for (Segment* s = firstSegment(Segment::Type::ChordRest); s; s = s->next1(Segment::Type::ChordRest)) {
if (s->tick() < tickStart)
continue;
Expand All @@ -698,6 +696,18 @@ void Score::transpositionChanged(Part* part, Interval oldV, int tickStart, int t
n->undoSetTpc2(tpc);
}
}
// find chord symbols
for (Element* e : s->annotations()) {
if (e->track() != track || e->type() != Element::Type::HARMONY)
continue;
Harmony* h = static_cast<Harmony*>(e);
int rootTpc = transposeTpc(h->rootTpc(), diffV, false);
int baseTpc = transposeTpc(h->baseTpc(), diffV, false);
for (ScoreElement* e : h->linkList()) {
if (!e->score()->styleB(StyleIdx::concertPitch))
undoTransposeHarmony(static_cast<Harmony*>(e), rootTpc, baseTpc);
}
}
}
}
}
Expand Down

0 comments on commit f8a0b29

Please sign in to comment.