MusicXML import/export for RNA/Nashville

This commit is contained in:
Marc Sabatella 2019-08-01 09:00:38 -06:00
parent cb433c6fbf
commit c5907f880c
3 changed files with 29 additions and 16 deletions

View file

@ -146,6 +146,7 @@ class Harmony final : public TextBase {
int rootTpc() const { return _rootTpc; }
void setRootTpc(int val) { _rootTpc = val; }
void setTextName(const QString& s) { _textName = s; }
void setFunction(const QString& s) { _function = s; }
QString rootName();
QString baseName();
void addDegree(const HDegree& d);

View file

@ -5811,18 +5811,29 @@ void ExportMusicXml::harmony(Harmony const* const h, FretDiagram const* const fd
_xml.stag(QString("harmony print-frame=\"yes\"")); // .append(relative));
else
_xml.stag(QString("harmony print-frame=\"no\"")); // .append(relative));
if (h->harmonyType() == HarmonyType::STANDARD) {
_xml.stag("root");
_xml.tag("root-step text=\"\"", "C");
_xml.etag(); // root
QString k = "kind text=\"" + h->hTextName() + "\"";
_xml.tag(k, "none");
}
else {
// TODO: parse?
_xml.tag("function", h->hTextName());
QString k = "kind text=\"" + h->hTextName() + "\"";
_xml.tag(k, "none");
switch (h->harmonyType()) {
case HarmonyType::NASHVILLE: {
_xml.tag("function", h->hFunction());
QString k = "kind text=\"" + h->hTextName() + "\"";
_xml.tag(k, "none");
}
break;
case HarmonyType::ROMAN: {
// TODO: parse?
_xml.tag("function", h->hTextName());
QString k = "kind text=\"\"";
_xml.tag(k, "none");
}
break;
case HarmonyType::STANDARD:
default: {
_xml.stag("root");
_xml.tag("root-step text=\"\"", "C");
_xml.etag(); // root
QString k = "kind text=\"" + h->hTextName() + "\"";
_xml.tag(k, "none");
}
break;
}
_xml.etag(); // harmony
#if 0

View file

@ -4881,7 +4881,7 @@ void MusicXMLParserPass2::harmony(const QString& partId, Measure* measure, const
QString printFrame = _e.attributes().value("print-frame").toString();
QString printStyle = _e.attributes().value("print-style").toString();
QString kind, kindText, symbols, parens;
QString kind, kindText, functionText, symbols, parens;
QList<HDegree> degreeList;
/* TODO ?
@ -4930,9 +4930,9 @@ void MusicXMLParserPass2::harmony(const QString& partId, Measure* measure, const
// attributes: print-style
ha->setRootTpc(Tpc::TPC_INVALID);
ha->setBaseTpc(Tpc::TPC_INVALID);
functionText = _e.readElementText();
// TODO: parse to decide between ROMAN and NASHVILLE
ha->setHarmonyType(HarmonyType::ROMAN);
QString text = _e.readElementText();
ha->setHarmony(text);
}
else if (_e.name() == "kind") {
// attributes: use-symbols yes-no
@ -5032,7 +5032,8 @@ void MusicXMLParserPass2::harmony(const QString& partId, Measure* measure, const
}
else {
ha->setId(-1);
ha->setTextName(kindText);
QString textName = functionText + kindText;
ha->setTextName(textName);
}
ha->render();