Skip to content

Commit

Permalink
Tweak MusicXML tempo inference logic
Browse files Browse the repository at this point in the history
This commit changes the method by which Staff Text is checked for
boldness, using a slightly more robust regex.
  • Loading branch information
iveshenry18 committed Jul 7, 2021
1 parent aab25bc commit fc9bc32
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions importexport/musicxml/importmxmlpass2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2462,7 +2462,7 @@ bool MusicXMLDelayedDirectionElement::isTempoOrphanCandidate() const
{
return _element->isStaffText()
&& _placement == "above"
&& toStaffText(_element)->xmlText().contains("<b>");
&& toStaffText(_element)->xmlText().contains(QRegularExpression("^(<.*/>)*<b>.*</b>$"));
}

//---------------------------------------------------------
Expand Down Expand Up @@ -3200,11 +3200,12 @@ bool MusicXMLParserDirection::attemptTempoTextCoercion(const Fraction& tick)
_tpoSound = tempoVal / noteVal;
return true;
}
else if (placement() == "above" && _wordsText.contains("<b>"))
else if (placement() == "above" && _wordsText.contains(QRegularExpression("^(<.*/>)*<b>.*</b>$"))) {
if (tick == Fraction(0, 1)) return true;
for (auto tempoWord : tempoWords)
if (_wordsText.contains(tempoWord, Qt::CaseInsensitive))
return true;
}
return false;
}

Expand Down

0 comments on commit fc9bc32

Please sign in to comment.