Skip to content

Commit

Permalink
Merge pull request #3664 from rettinghaus/xml-multirests
Browse files Browse the repository at this point in the history
MusicXML: allow short multi-measure rests to be blocks
  • Loading branch information
lpugin authored May 9, 2024
2 parents 5a08689 + 6051c8e commit 200be86
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/iomusxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1658,9 +1658,17 @@ bool MusicXmlInput::ReadMusicXmlMeasure(
for (pugi::xml_node::iterator it = node.begin(); it != node.end(); ++it) {
// first check if there is a multi measure rest
if (it->select_node(".//multiple-rest")) {
const int multiRestLength = it->select_node(".//multiple-rest").node().text().as_int();
const pugi::xml_node multiRestNode = it->select_node(".//multiple-rest").node();
const int multiRestLength = multiRestNode.text().as_int();
const std::string symbols = multiRestNode.attribute("use-symbols").as_string();
MultiRest *multiRest = new MultiRest;
if (it->select_node(".//multiple-rest[@use-symbols='yes']")) multiRest->SetBlock(BOOLEAN_false);
if (symbols == "no") {
// default by MusicXML specification
multiRest->SetBlock(BOOLEAN_true);
}
else if (symbols == "yes") {
multiRest->SetBlock(BOOLEAN_false);
}
multiRest->SetNum(multiRestLength);
Layer *layer = SelectLayer(1, measure);
AddLayerElement(layer, multiRest);
Expand Down

0 comments on commit 200be86

Please sign in to comment.