diff --git a/src/importexport/musicxml/internal/musicxml/exportxml.cpp b/src/importexport/musicxml/internal/musicxml/exportxml.cpp index 676d85d392eb1..059ce6722c06d 100644 --- a/src/importexport/musicxml/internal/musicxml/exportxml.cpp +++ b/src/importexport/musicxml/internal/musicxml/exportxml.cpp @@ -7746,26 +7746,23 @@ void ExportMusicXml::writeInstrumentChange(const InstrumentChange* instrChange) const Part* part = instrChange->part(); const size_t partNr = muse::indexOf(m_score->parts(), part); const int instNr = muse::value(m_instrMap, instr, -1); - static const std::wregex acc(L"[♭♯]"); + const String longName = instr->nameAsPlainText(); + const String shortName = instr->abbreviatureAsPlainText(); m_xml.startElement("print"); - m_xml.tag("part-name", instr->nameAsPlainText().replace(u"♭", u"b").replace(u"♯", u"#")); - if (instr->nameAsPlainText().contains(acc)) { + if (!longName.isEmpty()) { m_xml.startElement("part-name-display"); - writeDisplayName(m_xml, instr->nameAsPlainText()); + writeDisplayName(m_xml, longName); m_xml.endElement(); } - if (!instr->abbreviatureAsPlainText().isEmpty()) { - m_xml.tag("part-abbreviation", instr->abbreviatureAsPlainText().replace(u"♭", u"b").replace(u"♯", u"#")); - if (instr->abbreviatureAsPlainText().contains(acc)) { - m_xml.startElement("part-abbreviation-display"); - writeDisplayName(m_xml, instr->abbreviatureAsPlainText()); - m_xml.endElement(); - } + if (!shortName.isEmpty()) { + m_xml.startElement("part-abbreviation-display"); + writeDisplayName(m_xml, shortName); + m_xml.endElement(); } m_xml.endElement(); - writeInstrumentDetails(instrChange->instrument(), m_score->style().styleB(Sid::concertPitch)); + writeInstrumentDetails(instr, m_score->style().styleB(Sid::concertPitch)); m_xml.startElement("sound"); m_xml.startElement("instrument-change"); diff --git a/src/importexport/musicxml/tests/data/testChangeTranspose-no-diatonic_ref.xml b/src/importexport/musicxml/tests/data/testChangeTranspose-no-diatonic_ref.xml index 1110feba98ade..3a1951910a203 100644 --- a/src/importexport/musicxml/tests/data/testChangeTranspose-no-diatonic_ref.xml +++ b/src/importexport/musicxml/tests/data/testChangeTranspose-no-diatonic_ref.xml @@ -101,8 +101,12 @@ - A Clarinet - A Cl. + + A Clarinet + + + A Cl. + diff --git a/src/importexport/musicxml/tests/data/testChangeTranspose.xml b/src/importexport/musicxml/tests/data/testChangeTranspose.xml index f4773b45c2750..d4c72d1a3e1c9 100644 --- a/src/importexport/musicxml/tests/data/testChangeTranspose.xml +++ b/src/importexport/musicxml/tests/data/testChangeTranspose.xml @@ -101,8 +101,12 @@ - A Clarinet - A Cl. + + A Clarinet + + + A Cl. + diff --git a/src/importexport/musicxml/tests/data/testInstrumentChangeMIDIportExport_ref.xml b/src/importexport/musicxml/tests/data/testInstrumentChangeMIDIportExport_ref.xml index 4d98b4a69b8b0..a7938d6c8997b 100644 --- a/src/importexport/musicxml/tests/data/testInstrumentChangeMIDIportExport_ref.xml +++ b/src/importexport/musicxml/tests/data/testInstrumentChangeMIDIportExport_ref.xml @@ -1061,8 +1061,12 @@ - Voice - Vo. + + Voice + + + Vo. + diff --git a/src/importexport/musicxml/tests/data/testMultiInstrumentPart1.xml b/src/importexport/musicxml/tests/data/testMultiInstrumentPart1.xml index 8edd69d7afae9..78bd5afd99eb8 100644 --- a/src/importexport/musicxml/tests/data/testMultiInstrumentPart1.xml +++ b/src/importexport/musicxml/tests/data/testMultiInstrumentPart1.xml @@ -84,8 +84,12 @@ - Piano - Pno. + + Piano + + + Pno. + diff --git a/src/importexport/musicxml/tests/data/testMultiInstrumentPart2.xml b/src/importexport/musicxml/tests/data/testMultiInstrumentPart2.xml index df567bbd42634..b77928f019149 100644 --- a/src/importexport/musicxml/tests/data/testMultiInstrumentPart2.xml +++ b/src/importexport/musicxml/tests/data/testMultiInstrumentPart2.xml @@ -258,8 +258,12 @@ - Voice - Vo. + + Voice + + + Vo. + diff --git a/src/importexport/musicxml/tests/data/testMultiInstrumentPart3_ref.xml b/src/importexport/musicxml/tests/data/testMultiInstrumentPart3_ref.xml index b2801c8cbee34..58a0036dbc75e 100644 --- a/src/importexport/musicxml/tests/data/testMultiInstrumentPart3_ref.xml +++ b/src/importexport/musicxml/tests/data/testMultiInstrumentPart3_ref.xml @@ -169,13 +169,11 @@ - Bb Clarinet B flat Clarinet - Bb Cl. B flat