Skip to content

Commit

Permalink
fix #30586
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Aug 25, 2014
1 parent 02353b5 commit 9b27bef
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
21 changes: 14 additions & 7 deletions libmscore/measure.cpp
Expand Up @@ -2070,13 +2070,20 @@ void Measure::read(XmlReader& e, int staffIdx)
KeySig* ks = new KeySig(score());
ks->setTrack(e.track());
ks->read(e);
// if key sig not at beginning of measure => courtesy key sig
int currTick = e.tick();
bool courtesySig = (currTick > tick());
segment = getSegment(courtesySig ? Segment::Type::KeySigAnnounce : Segment::Type::KeySig, currTick);
segment->add(ks);
if (!courtesySig)
staff->setKey(currTick, ks->key());
int curTick = e.tick();
if (ks->key() == Key::C && curTick == 0) {
// ignore empty key signature
qDebug("remove keysig c at tick 0");
delete ks;
}
else {
// if key sig not at beginning of measure => courtesy key sig
bool courtesySig = (curTick > tick());
segment = getSegment(courtesySig ? Segment::Type::KeySigAnnounce : Segment::Type::KeySig, curTick);
segment->add(ks);
if (!courtesySig)
staff->setKey(curTick, ks->key());
}
}
else if (tag == "Lyrics") { // obsolete, keep for compatibility with version 114
Element* element = Element::name2Element(tag, score());
Expand Down
2 changes: 2 additions & 0 deletions libmscore/read114.cpp
Expand Up @@ -565,6 +565,8 @@ Score::FileError Score::read114(XmlReader& e)
qDebug("read114: Key tick %d", tick);
continue;
}
if (tick == 0 && i->second == Key::C)
continue;
Measure* m = tick2measure(tick);
if (!m) //empty score
break;
Expand Down

0 comments on commit 9b27bef

Please sign in to comment.