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 2, 2023
1 parent 4676bf5 commit 4af71c4
Show file tree
Hide file tree
Showing 6 changed files with 747 additions and 1 deletion.
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());
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
2 changes: 1 addition & 1 deletion libmscore/note.h
Expand Up @@ -315,7 +315,6 @@ class Note final : public Element {
int concertPitchIdx() const;
void updateRelLine(int relLine, bool undoable);
bool isNoteName() const;
SymId noteHead() const;

void normalizeLeftDragDelta(Segment* seg, EditData &ed, NoteEditData* ned);

Expand Down Expand Up @@ -515,6 +514,7 @@ class Note final : public Element {

void addParentheses();

SymId noteHead() const;
static SymId noteHead(int direction, NoteHead::Group, NoteHead::Type, int tpc, Key key, NoteHead::Scheme scheme);
static SymId noteHead(int direction, NoteHead::Group, NoteHead::Type);
NoteVal noteVal() const;
Expand Down

0 comments on commit 4af71c4

Please sign in to comment.