From 10fd6fda9da6e2472a59ff25e2f632c5fb95de29 Mon Sep 17 00:00:00 2001 From: rettinghaus Date: Sat, 21 Dec 2024 17:22:30 +0100 Subject: [PATCH] export notehead-text --- .../internal/musicxml/export/exportmusicxml.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp b/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp index c5c6e55519212..64398f02811df 100644 --- a/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp +++ b/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp @@ -3929,6 +3929,21 @@ static void writeNotehead(XmlWriter& xml, const Note* const note) noteheadTagname += String(u" smufl=\"%1\"").arg(String::fromAscii(noteheadName.ascii())); xml.tagRaw(noteheadTagname, "other"); } + + if (note->headScheme() == NoteHeadScheme::HEAD_PITCHNAME + || note->headScheme() == NoteHeadScheme::HEAD_PITCHNAME_GERMAN + || note->headScheme() == NoteHeadScheme::HEAD_SOLFEGE + || note->headScheme() == NoteHeadScheme::HEAD_SOLFEGE_FIXED) { + static const std::regex nameparts("^note([A-Z][a-z]*)(Sharp|Flat)?"); + AsciiStringView noteheadName = SymNames::nameForSymId(note->noteHead()); + StringList matches = String::fromAscii(noteheadName.ascii()).search(nameparts, { 1, 2 }, SplitBehavior::SkipEmptyParts); + xml.startElement("notehead-text"); + xml.tag("display-text", matches.at(0)); + if (matches.size() > 1) { + xml.tag("accidental-text", matches.at(1).toLower()); + } + xml.endElement(); + } } //---------------------------------------------------------