Skip to content

Commit

Permalink
MusicXML: Add export for smufl noteheads
Browse files Browse the repository at this point in the history
Adresses notehead issue from musescore#17553

Backport of musescore#19506
  • Loading branch information
rettinghaus authored and Jojo-Schmitz committed Oct 1, 2023
1 parent fef847e commit 053c456
Show file tree
Hide file tree
Showing 5 changed files with 746 additions and 0 deletions.
7 changes: 7 additions & 0 deletions importexport/musicxml/exportxml.cpp
Expand Up @@ -3269,6 +3269,8 @@ static void writeNotehead(XmlWriter& xml, const Note* const note)
xml.tag(noteheadTagname, "cross");
else if (note->headGroup() == NoteHead::Group::HEAD_CROSS)
xml.tag(noteheadTagname, "x");
else if (note->headGroup() == NoteHead::Group::HEAD_CIRCLED)
xml.tag(noteheadTagname, "circled");
else if (note->headGroup() == NoteHead::Group::HEAD_XCIRCLE)
xml.tag(noteheadTagname, "circle-x");
else if (note->headGroup() == NoteHead::Group::HEAD_TRIANGLE_DOWN)
Expand Down Expand Up @@ -3299,6 +3301,11 @@ static void writeNotehead(XmlWriter& xml, const Note* const note)
xml.tag(noteheadTagname, "normal");
else if (note->headType() != NoteHead::Type::HEAD_AUTO)
xml.tag(noteheadTagname, "normal");
else if (note->headGroup() != NoteHead::Group::HEAD_NORMAL) {
const char* noteheadName = Sym::id2name(note->noteHead(note->chord()->up(), note->headGroup(), note->headType()));
noteheadTagname += QString(" smufl=\"%1\"").arg(noteheadName);
xml.tag(noteheadTagname, "other");
}
}

//---------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions importexport/musicxml/importmxmlpass2.cpp
Expand Up @@ -1248,11 +1248,13 @@ static NoteHead::Group convertNotehead(QString mxmlName)
map["diamond"] = int(NoteHead::Group::HEAD_DIAMOND);
map["cross"] = int(NoteHead::Group::HEAD_PLUS);
map["x"] = int(NoteHead::Group::HEAD_CROSS);
map["circled"] = int(NoteHead::Group::HEAD_CIRCLED);
map["circle-x"] = int(NoteHead::Group::HEAD_XCIRCLE);
map["inverted triangle"] = int(NoteHead::Group::HEAD_TRIANGLE_DOWN);
map["slashed"] = int(NoteHead::Group::HEAD_SLASHED1);
map["back slashed"] = int(NoteHead::Group::HEAD_SLASHED2);
map["normal"] = int(NoteHead::Group::HEAD_NORMAL);
map["rectangle"] = int(NoteHead::Group::HEAD_LA);
map["do"] = int(NoteHead::Group::HEAD_DO);
map["re"] = int(NoteHead::Group::HEAD_RE);
map["mi"] = int(NoteHead::Group::HEAD_MI);
Expand Down

0 comments on commit 053c456

Please sign in to comment.