Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #53936: incomplete MusicXML text for 7sus4 #1923

Merged
merged 1 commit into from
Apr 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion libmscore/chordlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,10 +809,12 @@ bool ParsedChord::parse(const QString& s, const ChordList* cl, bool syntaxOnly,
// eat spaces
while (i < len && s[i] == ' ')
++i;
// get second token - up to first non-digit
// get second token - a number <= 13
for (j = 0, tok2 = ""; i < len; ++i) {
if (!s[i].isDigit())
break;
if (j == 1 && (tok2[0] != '1' || s[i] > '3'))
break;
tok2[j++] = s[i];
}
tok2L = tok2.toLower();
Expand Down Expand Up @@ -887,6 +889,8 @@ bool ParsedChord::parse(const QString& s, const ChordList* cl, bool syntaxOnly,
d = 0;
else
d = tok2L.toInt();
if (d > 13)
d = 13;
QString degree;
bool alter = false;
if (tok1L == "add") {
Expand Down Expand Up @@ -947,6 +951,10 @@ bool ParsedChord::parse(const QString& s, const ChordList* cl, bool syntaxOnly,
_xmlText = tok1 + tok2;
if (_extension == "7" || _extension == "9" || _extension == "11" || _extension == "13") {
_xmlDegrees += (_quality == "major") ? "add#7" : "add7";
// hack for programs that cannot assemble names well
// even though the kind is suspended, set text to also include the extension
// in export, we will set the degree text to null
_xmlText = _extension + _xmlText;
degree = "";
}
else if (_extension != "")
Expand Down
22 changes: 20 additions & 2 deletions mscore/exportxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4972,8 +4972,9 @@ void ExportMusicXml::harmony(Harmony const* const h, FretDiagram const* const fd

if (!h->xmlKind().isEmpty()) {
QString s = "kind";
QString kindText = h->xmlText();
if (h->xmlText() != "")
s += " text=\"" + h->xmlText() + "\"";
s += " text=\"" + kindText + "\"";
if (h->xmlSymbols() == "yes")
s += " use-symbols=\"yes\"";
if (h->xmlParens() == "yes")
Expand All @@ -4982,7 +4983,24 @@ void ExportMusicXml::harmony(Harmony const* const h, FretDiagram const* const fd
QStringList l = h->xmlDegrees();
if (!l.isEmpty()) {
foreach(QString tag, l) {
xml.stag("degree");
QString degreeText;
if (h->xmlKind().startsWith("suspended")
&& tag.startsWith("add") && tag[3].isDigit()
&& !kindText.isEmpty() && kindText[0].isDigit()) {
// hack to correct text for suspended chords whose kind text has degree information baked in
// (required by some other applications)
int tagDegree = tag.mid(3).toInt();
QString kindTextExtension;
for (int i = 0; i < kindText.length() && kindText[i].isDigit(); ++i)
kindTextExtension[i] = kindText[i];
int kindExtension = kindTextExtension.toInt();
if (tagDegree <= kindExtension && (tagDegree & 1) && (kindExtension & 1))
degreeText = "\"\"";
}
if (degreeText.isEmpty())
xml.stag("degree");
else
xml.stag("degree text=" + degreeText);
int alter = 0;
int idx = 3;
if (tag[idx] == '#') {
Expand Down