Skip to content

Commit

Permalink
Merge pull request rism-digital#1079 from wergo/develop-musicXMLimpor…
Browse files Browse the repository at this point in the history
…t-mRest

MusicXml import: Rests with duration of one measure imported as `mRest`
  • Loading branch information
lpugin authored May 24, 2019
2 parents aa30787 + 2dc9757 commit 450c2b1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/iomusxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ bool MusicXmlInput::ReadMusicXmlMeasure(
// and with earliest end note.
if (iter->second->GetPname() == (*jter)->GetPname() && iter->second->GetOct() == (*jter)->GetOct()
&& (iter->second->GetScoreTimeOnset() < (*jter)->GetScoreTimeOnset()
&& (*jter)->GetScoreTimeOnset() < lastScoreTimeOnset)) {
&& (*jter)->GetScoreTimeOnset() < lastScoreTimeOnset)) {
iter->first->SetEndid("#" + (*jter)->GetUuid());
lastScoreTimeOnset = (*jter)->GetScoreTimeOnset();
tieMatched = true;
Expand Down Expand Up @@ -1612,14 +1612,16 @@ void MusicXmlInput::ReadMusicXmlNote(pugi::xml_node node, Measure *measure, std:
if (rest) {
std::string stepStr = GetContentOfChild(rest.node(), "display-step");
std::string octaveStr = GetContentOfChild(rest.node(), "display-octave");
int duration = atoi(GetContentOfChild(node, "duration").c_str());
if (HasAttributeWithValue(node, "print-object", "no")) {
Space *space = new Space();
element = space;
space->SetDur(ConvertTypeToDur(typeStr));
AddLayerElement(layer, space);
}
// we assume /note without /type to be mRest
else if (typeStr.empty() || HasAttributeWithValue(rest.node(), "measure", "yes")) {
// we assume /note without /type or with duration of an entire bar to be mRest
else if (typeStr.empty() || duration == (m_ppq * 4 * m_meterCount / m_meterUnit)
|| HasAttributeWithValue(rest.node(), "measure", "yes")) {
if (m_slash) {
for (int i = m_meterCount; i > 0; --i) {
BeatRpt *slash = new BeatRpt;
Expand All @@ -1641,7 +1643,7 @@ void MusicXmlInput::ReadMusicXmlNote(pugi::xml_node node, Measure *measure, std:
Rest *rest = new Rest();
element = rest;
rest->SetDur(ConvertTypeToDur(typeStr));
rest->SetDurPpq(atoi(GetContentOfChild(node, "duration").c_str()));
rest->SetDurPpq(duration);
if (dots > 0) rest->SetDots(dots);
// FIXME MEI 4.0.0
// if (cue) rest->SetSize(SIZE_cue);
Expand Down

0 comments on commit 450c2b1

Please sign in to comment.