Skip to content

Commit

Permalink
Fix #304918: Channel lists contain bad values after an instrument change
Browse files Browse the repository at this point in the history
Resolves: https://musescore.org/en/node/304918.

Since an instrument change applies to an entire part rather than a single
staff, it is necessary to update the channel lists for all staves belonging
to the part when an instrument change occurs, and not just the staff where
the instrument change is placed.
  • Loading branch information
mattmcclinch committed May 6, 2020
1 parent 5eaa04f commit a1bafa3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions libmscore/rendermidi.cpp
Expand Up @@ -165,9 +165,10 @@ void Score::updateChannel()
for (Segment* s = fm->first(SegmentType::ChordRest); s; s = s->next1(SegmentType::ChordRest)) {
for (const Element* e : s->annotations()) {
if (e->isInstrumentChange()) {
Staff* staff = Score::staff(e->staffIdx());
for (int voice = 0; voice < VOICES; ++voice)
staff->insertIntoChannelList(voice, s->tick(), 0);
for (Staff* staff : *e->part()->staves()) {
for (int voice = 0; voice < VOICES; ++voice)
staff->insertIntoChannelList(voice, s->tick(), 0);
}
continue;
}
if (!e->isStaffTextBase())
Expand Down

0 comments on commit a1bafa3

Please sign in to comment.