From 6385efe02f7eac5ada798dea1b0b623aad1b9379 Mon Sep 17 00:00:00 2001 From: James Mizen Date: Thu, 19 Sep 2024 16:37:39 +0200 Subject: [PATCH 1/2] Improve XML instrument import Backport of #23366, only partial, not the 'other improvements' --- importexport/musicxml/importmxmlpass1.cpp | 22 +- importexport/musicxml/importmxmlpass1.h | 6 +- mtest/musicxml/io/testFinaleInstr.xml | 1250 +++++++++++ mtest/musicxml/io/testFinaleInstr2.xml | 649 ++++++ mtest/musicxml/io/testFinaleInstr2_ref.mscx | 1052 +++++++++ mtest/musicxml/io/testFinaleInstr_ref.mscx | 2197 +++++++++++++++++++ mtest/musicxml/io/tst_mxml_io.cpp | 2 + 7 files changed, 5168 insertions(+), 10 deletions(-) create mode 100644 mtest/musicxml/io/testFinaleInstr.xml create mode 100644 mtest/musicxml/io/testFinaleInstr2.xml create mode 100644 mtest/musicxml/io/testFinaleInstr2_ref.mscx create mode 100644 mtest/musicxml/io/testFinaleInstr_ref.mscx diff --git a/importexport/musicxml/importmxmlpass1.cpp b/importexport/musicxml/importmxmlpass1.cpp index b0ad690510e3c..acd1355cfab9d 100644 --- a/importexport/musicxml/importmxmlpass1.cpp +++ b/importexport/musicxml/importmxmlpass1.cpp @@ -1916,12 +1916,13 @@ void MusicXMLParserPass1::partList(MusicXmlPartGroupList& partGroupList) int scoreParts = 0; // number of score-parts read sofar MusicXmlPartGroupMap partGroups; + QString curPartGroupName; while (_e.readNextStartElement()) { if (_e.name() == "part-group") - partGroup(scoreParts, partGroupList, partGroups); + partGroup(scoreParts, partGroupList, partGroups, curPartGroupName); else if (_e.name() == "score-part") { - scorePart(); + scorePart(curPartGroupName); scoreParts++; } else @@ -2036,7 +2037,7 @@ static void partGroupStop(MusicXmlPartGroupMap& pgs, int n, int p, void MusicXMLParserPass1::partGroup(const int scoreParts, MusicXmlPartGroupList& partGroupList, - MusicXmlPartGroupMap& partGroups) + MusicXmlPartGroupMap& partGroups, QString& curPartGroupName) { _logger->logDebugTrace("MusicXMLParserPass1::partGroup", &_e); bool barlineSpan = true; @@ -2048,7 +2049,7 @@ void MusicXMLParserPass1::partGroup(const int scoreParts, while (_e.readNextStartElement()) { if (_e.name() == "group-name") - _e.skipCurrentElement(); // skip but don't log + curPartGroupName = _e.readElementText(); else if (_e.name() == "group-abbreviation") symbol = _e.readElementText(); else if (_e.name() == "group-symbol") @@ -2122,7 +2123,7 @@ void MusicXMLParserPass1::addInferredTranspose(const QString& partId) which is invalid MusicXML but is (sometimes ?) generated by NWC2MusicXML. */ -void MusicXMLParserPass1::scorePart() +void MusicXMLParserPass1::scorePart(const QString& curPartGroupName) { _logger->logDebugTrace("MusicXMLParserPass1::scorePart", &_e); QString id = _e.attributes().value("id").toString().trimmed(); @@ -2186,7 +2187,7 @@ void MusicXMLParserPass1::scorePart() else if (_e.name() == "group") // TODO _e.skipCurrentElement(); // skip but don't log else if (_e.name() == "score-instrument") - scoreInstrument(id); + scoreInstrument(id, curPartGroupName); else if (_e.name() == "player") // unsupported _e.skipCurrentElement(); // skip but don't log else if (_e.name() == "midi-device") { @@ -2222,7 +2223,7 @@ void MusicXMLParserPass1::scorePart() Parse the /score-partwise/part-list/score-part/score-instrument node. */ -void MusicXMLParserPass1::scoreInstrument(const QString& partId) +void MusicXMLParserPass1::scoreInstrument(const QString& partId, const QString& curPartGroupName) { _logger->logDebugTrace("MusicXMLParserPass1::scoreInstrument", &_e); QString instrId = _e.attributes().value("id").toString(); @@ -2239,6 +2240,13 @@ void MusicXMLParserPass1::scoreInstrument(const QString& partId) qPrintable(instrName) ); */ + + // Finale exports all instrument names as 'Grand Piano' - use part name + if (_exporterString.contains("finale")) { + instrName = _parts[partId].getName(); + if (instrName.size() <= 1) + instrName = curPartGroupName; + } _instruments[partId].insert(instrId, MusicXMLInstrument(instrName)); // Element instrument-name is typically not displayed in the score, // but used only internally diff --git a/importexport/musicxml/importmxmlpass1.h b/importexport/musicxml/importmxmlpass1.h index 77fe25d28ad41..b8a9d76afdf23 100644 --- a/importexport/musicxml/importmxmlpass1.h +++ b/importexport/musicxml/importmxmlpass1.h @@ -128,10 +128,10 @@ class MusicXMLParserPass1 { void defaults(); void pageLayout(MxmlPageFormat& pf, const qreal conversion); void partList(MusicXmlPartGroupList& partGroupList); - void partGroup(const int scoreParts, MusicXmlPartGroupList& partGroupList, MusicXmlPartGroupMap& partGroups); - void scorePart(); + void partGroup(const int scoreParts, MusicXmlPartGroupList& partGroupList, MusicXmlPartGroupMap& partGroups, QString& curPartGroupName); + void scorePart(const QString& curPartGroupName); void setStyle(const QString& type, const double val); - void scoreInstrument(const QString& partId); + void scoreInstrument(const QString& partId, const QString& curPartGroupName); void midiInstrument(const QString& partId); void part(); void measure(const QString& partId, const Fraction cTime, Fraction& mdur, VoiceOverlapDetector& vod, const int measureNr); diff --git a/mtest/musicxml/io/testFinaleInstr.xml b/mtest/musicxml/io/testFinaleInstr.xml new file mode 100644 index 0000000000000..17284d8334a68 --- /dev/null +++ b/mtest/musicxml/io/testFinaleInstr.xml @@ -0,0 +1,1250 @@ + + + + + + Finale v27.4 for Windows + 2024-06-13 + + + + + + + + + + 5.2493 + 40 + + + 2323 + 1742 + + 97 + 97 + 97 + 97 + + + + + 105 + 0 + + 110 + 72 + + + 60 + + + 0.957 + 5.0391 + 0.957 + 0.957 + 5.0391 + 0.957 + 0.957 + 0.7487 + 0.7682 + 0.7682 + 65 + 65 + 20 + 7.5 + unpitchedPercussionClef1 + + + + + + + bracket + yes + + + Flute/Piccolo + + Flute/Piccolo + + Fl./Picc. + + Fl./Picc. + + score + + Grand Piano + wind.flutes.flute + + + 1 + 1 + 80 + 0 + + + + Oboe + + Oboe + + Ob. + + Ob. + + score + + Grand Piano + wind.reed.oboe + + + 1 + 1 + 80 + 0 + + + + Bassoon + + Bassoon + + Bsn. + + Bsn. + + score + + Grand Piano + wind.reed.bassoon + + + 1 + 1 + 80 + 0 + + + + + bracket + yes + + + Bb Clarinet 1 + + Bb Clarinet 1 + + Cl. 1 + + Cl. 1 + + score + + Grand Piano + + + 1 + 1 + 80 + 0 + + + + Bb Clarinet 2, 3 + + Bb Clarinet 2, 3 + + Cl. 2, 3 + + Cl. 2, 3 + + score + + Grand Piano + + + 1 + 1 + 80 + 0 + + + + Eb Alto Clarinet + + Eb Alto Clarinet + + A. Cl. + + A. Cl. + + score + + Grand Piano + + + 1 + 1 + 80 + 0 + + + + Bb Bass Clarinet + + Bb Bass Clarinet + + Bs. Cl. + + Bs. Cl. + + score + + Grand Piano + + + 1 + 1 + 80 + 0 + + + + + bracket + yes + + + Eb Alto Sax. 1, 2 + + Eb Alto Sax. 1, 2 + + A. Sx. 1, 2 + + A. Sx. 1, 2 + + score + + Grand Piano + + + 1 + 1 + 80 + 0 + + + + Bb Tenor Sax. + + Bb Tenor Sax. + + T. Sx. + + T. Sx. + + score + + Grand Piano + + + 1 + 1 + 80 + 0 + + + + Eb Bari. Sax. + + Eb Bari. Sax. + + B. Sx. + + B. Sx. + + score + + Grand Piano + + + 1 + 1 + 80 + 0 + + + + + bracket + yes + + + Bb Trumpet 1 + + Bb Trumpet 1 + + Tpt. 1 + + Tpt. 1 + + score + + Grand Piano + + + 1 + 1 + 80 + 0 + + + + Bb Trumpet 2, 3 + + Bb Trumpet 2, 3 + + Tpt. 2, 3 + + Tpt. 2, 3 + + score + + Grand Piano + + + 1 + 1 + 80 + 0 + + + + F Horn 1, 2 + + F Horn 1, 2 + + Horn 1, 2 + + Horn 1, 2 + + score + + Grand Piano + + + 1 + 1 + 80 + 0 + + + + + bracket + yes + + + Trombone 1, 2 + + Trombone 1, 2 + + Tbn. 1, 2 + + Tbn. 1, 2 + + score + + Grand Piano + brass.trombone + + + 1 + 1 + 80 + 0 + + + + Baritone + + Baritone + + Bar. + + Bar. + + score + + Grand Piano + voice.baritone + + + 1 + 1 + 80 + 0 + + + + Tuba (String Bass) + + Tuba +(String Bass) + + Tuba + + Tuba + + score + + Grand Piano + brass.tuba + + + 1 + 1 + 80 + 0 + + + + + bracket + yes + + + Percussion 1 + + Percussion 1 + + Perc. 1 + + Perc. 1 + + score + + Grand Piano + + + 1 + 1 + 80 + 0 + + + + Percussion 2 + + Percussion 2 + + Perc. 2 + + Perc. 2 + + score + + Grand Piano + + + 1 + 1 + 80 + 0 + + + + Mallet Perc. + + Mallet Perc. + + Mllt. Perc. + + Mllt. Perc. + + score + + Grand Piano + + + 1 + 1 + 80 + 0 + + + + Timpani + + Timpani + + Timp. + + Timp. + + score + + Grand Piano + drum.timpani + + + 1 + 1 + 80 + 0 + + + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + \ No newline at end of file diff --git a/mtest/musicxml/io/testFinaleInstr2.xml b/mtest/musicxml/io/testFinaleInstr2.xml new file mode 100644 index 0000000000000..91e8994866595 --- /dev/null +++ b/mtest/musicxml/io/testFinaleInstr2.xml @@ -0,0 +1,649 @@ + + + + + + Finale v27.4 for Windows + 2024-06-04 + + + + + + + + + + 6.7733 + 40 + + + 1729 + 1275 + + 0 + 75 + 0 + 38 + + + + + 73 + 0 + + 123 + 60 + + + 88 + + + 1.0807 + 5.0391 + 1.0807 + 1.0807 + 5.0391 + 1.0807 + 1.1979 + 0.7227 + 0.7227 + 1.0807 + 65 + 65 + 720 + 7.5 + + + + + + + Violin + Violin + bracket + yes + + + A + + A + + A + + A + + score + + Flute + + + 1 + 1 + 80 + 0 + + + + B + + B + + B + + B + + score + + Instrument 1 + + + 1 + 1 + 80 + 0 + + + + + Viola + Viola + bracket + yes + + + A + + A + + A + + A + + score + + Clarinet + + + 1 + 1 + 80 + 0 + + + + B + + B + + B + + B + + score + + Instrument 1 + + + 1 + 1 + 80 + 0 + + + + + bracket + yes + + + A + + A + + A + + A + + score + + Alto Sax + + + 1 + 1 + 80 + 0 + + + + Cello B + Cello B + score + + Instrument 1 + strings.cello + + + + 1 + 1 + 80 + 0 + + + + C + + C + + C + + C + + score + + Instrument 1 + + + 1 + 1 + 80 + 0 + + + + + Bass + Bass + bracket + yes + + + A + + A + + A + + A + + score + + Tenor Sax + + + 1 + 1 + 80 + 0 + + + + C + + C + + C + + C + + score + + Instrument 1 + + + 1 + 1 + 80 + 0 + + + + + Piano + Piano + score + + Instrument 1 + keyboard.piano + + + 1 + 1 + 80 + 0 + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + + + + + + 50 + 831.82 + + 170 + + + + 1 + + 0 + + + + G + 2 + + + + + 4 + 1 + + + light-heavy + + + + + diff --git a/mtest/musicxml/io/testFinaleInstr2_ref.mscx b/mtest/musicxml/io/testFinaleInstr2_ref.mscx new file mode 100644 index 0000000000000..0e80eab99f79d --- /dev/null +++ b/mtest/musicxml/io/testFinaleInstr2_ref.mscx @@ -0,0 +1,1052 @@ + + + + + 0 + 480 + + 1 + 1 + 1 + 0 + + + + + + + + + + + + + + + stdNormal + + 3 + + 1 + + A + + A + A + Violin + 55 + 103 + 55 + 88 + strings.violin + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 0 + 0 + + + + 0 + 1 + + + + 0 + 2 + + + + + + + stdNormal + + 3 + + B + + B + B + Violin + 55 + 103 + 55 + 88 + strings.violin + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 1 + 0 + + + + 0 + 3 + + + + 0 + 4 + + + + + + + stdNormal + + 3 + + 1 + + A + + A + A + Viola + 48 + 93 + 48 + 79 + strings.viola + C3 + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 2 + 0 + + + + 0 + 5 + + + + 0 + 6 + + + + + + + stdNormal + + 3 + + B + + B + B + Viola + 48 + 93 + 48 + 79 + strings.viola + C3 + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 3 + 0 + + + + 0 + 7 + + + + 0 + 8 + + + + + + + stdNormal + + 3 + + 1 + + A + + A + A + Viola + 48 + 93 + 48 + 79 + strings.viola + C3 + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 4 + 0 + + + + 0 + 10 + + + + 0 + 11 + + + + + + + stdNormal + + 3 + 1 + + Cello B + + Cello B + Cello B + Cello B + 36 + 90 + 36 + 67 + strings.cello + F + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 5 + 0 + + + + 0 + 12 + + + + 0 + 13 + + + + + + + stdNormal + + 3 + + C + + C + C + Viola + 48 + 93 + 48 + 79 + strings.viola + C3 + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 6 + 0 + + + + 0 + 14 + + + + 0 + 15 + + + + + + + stdNormal + + 3 + + 1 + + A + + A + A + Bass + 38 + 62 + 41 + 60 + voice.bass + F + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 7 + 0 + + + + + + + stdNormal + + 3 + + C + + C + C + Bass + 38 + 62 + 41 + 60 + voice.bass + F + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 8 + 0 + + + + + + + stdNormal + + 3 + + Piano + + Piano + Piano + Piano + 21 + 108 + 21 + 108 + keyboard.piano + F + + 100 + 95 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 9 + 0 + + + + + + 10 + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + diff --git a/mtest/musicxml/io/testFinaleInstr_ref.mscx b/mtest/musicxml/io/testFinaleInstr_ref.mscx new file mode 100644 index 0000000000000..8ef27145c4f7f --- /dev/null +++ b/mtest/musicxml/io/testFinaleInstr_ref.mscx @@ -0,0 +1,2197 @@ + + + + + 0 + 480 + + 1 + 1 + 1 + 0 + + + + + + + + + + + + + + + stdNormal + + 3 + + 1 + + Flute/Piccolo + + Flute/Piccolo + Fl./Picc. + Flute/Piccolo + 59 + 98 + 60 + 93 + wind.flutes.flute + + 100 + 95 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 0 + 0 + + + + + + + stdNormal + + 3 + 1 + + Oboe + + Oboe + Ob. + Oboe + 58 + 96 + 58 + 87 + wind.reed.oboe + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 1 + 0 + + + + + + + stdNormal + + 3 + + Bassoon + + Bassoon + Bsn. + Bassoon + 34 + 76 + 34 + 69 + wind.reed.bassoon + F + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 2 + 0 + + + + + + + stdNormal + + 3 + + 1 + + Bb Clarinet 1 + + Bb Clarinet 1 + Cl. 1 + Bb Clarinet 1 + 50 + 94 + 50 + 89 + wind.reed.clarinet.bflat + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 3 + 0 + + + + + + + stdNormal + + 3 + 1 + + Bb Clarinet 2, 3 + + Bb Clarinet 2, 3 + Cl. 2, 3 + Bb Clarinet 2, 3 + 50 + 94 + 50 + 89 + wind.reed.clarinet.bflat + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 4 + 0 + + + + + + + stdNormal + + 3 + 1 + + Eb Alto Clarinet + + Eb Alto Clarinet + A. Cl. + Eb Alto Clarinet + 43 + 84 + 43 + 80 + wind.reed.clarinet.alto + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 5 + 0 + + + + + + + stdNormal + + 3 + + Bb Bass Clarinet + + Bb Bass Clarinet + Bs. Cl. + Bb Bass Clarinet + 34 + 82 + 37 + 75 + wind.reed.clarinet.bass + G8vb + G + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 6 + 0 + + + + + + + stdNormal + + 3 + + 1 + + Eb Alto Sax. 1, 2 + + Eb Alto Sax. 1, 2 + A. Sx. 1, 2 + Eb Alto Sax. 1, 2 + 49 + 92 + 49 + 80 + wind.reed.saxophone.alto + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 7 + 0 + + + + + + + stdNormal + + 3 + 1 + + Bb Tenor Sax. + + Bb Tenor Sax. + T. Sx. + Bb Tenor Sax. + 44 + 87 + 44 + 75 + wind.reed.saxophone.tenor + G8vb + G + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 8 + 0 + + + + + + + stdNormal + + 3 + + Eb Bari. Sax. + + Eb Bari. Sax. + B. Sx. + Eb Bari. Sax. + 36 + 80 + 36 + 68 + wind.reed.saxophone.baritone + F + G + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 9 + 0 + + + + + + + stdNormal + + 3 + + 1 + + Bb Trumpet 1 + + Bb Trumpet 1 + Tpt. 1 + Bb Trumpet 1 + 52 + 85 + 52 + 80 + brass.trumpet.bflat + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 10 + 0 + + + + 0 + 1 + + + + + + + stdNormal + + 3 + 1 + + Bb Trumpet 2, 3 + + Bb Trumpet 2, 3 + Tpt. 2, 3 + Bb Trumpet 2, 3 + 52 + 85 + 52 + 80 + brass.trumpet.bflat + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 11 + 0 + + + + 0 + 2 + + + + + + + stdNormal + + 3 + + F Horn 1, 2 + + F Horn 1, 2 + Horn 1, 2 + F Horn 1, 2 + 31 + 77 + 41 + 69 + brass.french-horn + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 12 + 0 + + + + 0 + 3 + + + + + + + stdNormal + + 3 + + 1 + + Trombone 1, 2 + + Trombone 1, 2 + Tbn. 1, 2 + Trombone 1, 2 + 36 + 74 + 40 + 71 + brass.trombone + F + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 13 + 0 + + + + 0 + 4 + + + + + + + stdNormal + + 3 + 1 + + Baritone + + Baritone + Bar. + Baritone + 41 + 65 + 43 + 64 + voice.baritone + F + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 14 + 0 + + + + + + + stdNormal + + 3 + + Tuba +(String Bass) + + Tuba +(String Bass) + Tuba + Tuba +(String Bass) + 22 + 72 + 28 + 58 + brass.tuba + F + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 15 + 0 + + + + + + + stdNormal + + 3 + + 1 + + Percussion 1 + + Percussion 1 + Perc. 1 + Percussion 1 + drum.group.set + 1 + + cross + -1 + 0 + Closed Hi-Hat + 1 + G + + + cross + 9 + 1 + Pedal Hi-Hat + 2 + F + + + cross + 1 + 0 + Open Hi-Hat + 1 + E + + + cross + 0 + 0 + Ride Cymbal 1 + 1 + + + normal + 7 + 1 + Bass Drum 1 + 2 + B + + + cross + 3 + 0 + Side Stick + 1 + + + normal + 3 + 0 + Acoustic Snare + 1 + A + + + diamond + 2 + 0 + Tambourine + 1 + + + cross + -3 + 0 + Splash Cymbal + 1 + + + triangle-down + 1 + 0 + Cowbell + 1 + + + diamond + 1 + 0 + Vibraslap + 1 + + + cross + -2 + 0 + Hand Cymbals + 1 + C + + + cross + 2 + 0 + Mute High Conga + 1 + + + cross + 4 + 0 + Open High Conga + 1 + + + cross + 6 + 0 + Low Conga + 1 + + + normal + 2 + 0 + Maracas + 1 + + + normal + 0 + 0 + Claves + 1 + + + diamond + 0 + 0 + Open Triangle + 1 + D + + + normal + 4 + 0 + Shaker + 1 + + + cross + 2 + 0 + Mark Tree + 1 + + + normal + 1 + 0 + Castanets + 1 + + PERC + 0 + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 16 + 0 + + + + + + + stdNormal + + 3 + 1 + + Percussion 2 + + Percussion 2 + Perc. 2 + Percussion 2 + drum.group.set + 1 + + cross + -1 + 0 + Closed Hi-Hat + 1 + G + + + cross + 9 + 1 + Pedal Hi-Hat + 2 + F + + + cross + 1 + 0 + Open Hi-Hat + 1 + E + + + cross + 0 + 0 + Ride Cymbal 1 + 1 + + + normal + 7 + 1 + Bass Drum 1 + 2 + B + + + cross + 3 + 0 + Side Stick + 1 + + + normal + 3 + 0 + Acoustic Snare + 1 + A + + + diamond + 2 + 0 + Tambourine + 1 + + + cross + -3 + 0 + Splash Cymbal + 1 + + + triangle-down + 1 + 0 + Cowbell + 1 + + + diamond + 1 + 0 + Vibraslap + 1 + + + cross + -2 + 0 + Hand Cymbals + 1 + C + + + cross + 2 + 0 + Mute High Conga + 1 + + + cross + 4 + 0 + Open High Conga + 1 + + + cross + 6 + 0 + Low Conga + 1 + + + normal + 2 + 0 + Maracas + 1 + + + normal + 0 + 0 + Claves + 1 + + + diamond + 0 + 0 + Open Triangle + 1 + D + + + normal + 4 + 0 + Shaker + 1 + + + cross + 2 + 0 + Mark Tree + 1 + + + normal + 1 + 0 + Castanets + 1 + + PERC + 0 + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 17 + 0 + + + + + + + stdNormal + + 3 + 1 + + Mallet Perc. + + Mallet Perc. + Mllt. Perc. + Mallet Perc. + 21 + 108 + 21 + 108 + keyboard.piano.grand + F + 0 + + 100 + 95 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 18 + 0 + + + + + + + stdNormal + + 3 + + Timpani + + Timpani + Timp. + Timpani + 36 + 62 + 38 + 60 + drum.timpani + F + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + 19 + 0 + + + + + + 10 + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + + + + G + G + + + 4 + 4 + + + measure + 1/1 + + + end + + + + + + diff --git a/mtest/musicxml/io/tst_mxml_io.cpp b/mtest/musicxml/io/tst_mxml_io.cpp index 714e6d5229a5f..78a55a36feda3 100644 --- a/mtest/musicxml/io/tst_mxml_io.cpp +++ b/mtest/musicxml/io/tst_mxml_io.cpp @@ -138,6 +138,8 @@ private slots: void figuredBass2() { mxmlIoTest("testFiguredBass2"); } void figuredBass3() { mxmlIoTest("testFiguredBass3"); } void figuredBassDivisions() { mxmlIoTest("testFiguredBassDivisions"); } + //void finaleInstr() { mxmlImportTestRef("testFinaleInstr"); } // TODO + void finaleInstr2() { mxmlImportTestRef("testFinaleInstr2"); } // void formattedThings() { mxmlIoTest("testFormattedThings"); } // TODO void fractionMinus() { mxmlIoTestRef("testFractionMinus"); } void fractionPlus() { mxmlIoTestRef("testFractionPlus"); } From 5990d89710aa568c651fbdfae8c0d41161fe591f Mon Sep 17 00:00:00 2001 From: James Mizen Date: Wed, 18 Sep 2024 12:15:36 +0200 Subject: [PATCH 2/2] XML ottava fixes Backport of #24776 --- importexport/musicxml/importmxmlpass1.cpp | 38 +++- importexport/musicxml/importmxmlpass1.h | 16 +- importexport/musicxml/importmxmlpass2.cpp | 46 ++-- mtest/musicxml/io/testDoletOttavas.xml | Bin 0 -> 10908 bytes mtest/musicxml/io/testDoletOttavas_ref.mscx | 231 ++++++++++++++++++++ mtest/musicxml/io/testSibOttavas.xml | Bin 10908 -> 7160 bytes mtest/musicxml/io/testSibOttavas_ref.mscx | 103 ++++++--- mtest/musicxml/io/tst_mxml_io.cpp | 1 + 8 files changed, 387 insertions(+), 48 deletions(-) create mode 100644 mtest/musicxml/io/testDoletOttavas.xml create mode 100644 mtest/musicxml/io/testDoletOttavas_ref.mscx diff --git a/importexport/musicxml/importmxmlpass1.cpp b/importexport/musicxml/importmxmlpass1.cpp index acd1355cfab9d..3570b904d808b 100644 --- a/importexport/musicxml/importmxmlpass1.cpp +++ b/importexport/musicxml/importmxmlpass1.cpp @@ -200,6 +200,22 @@ void MusicXMLParserPass1::addError(const QString& error) } } +void MusicXMLParserPass1::setExporterSoftware(QString& exporter) + { + if (exporter.contains("sibelius")) { + if (exporter.contains("dolet 6")) + _exporterSoftware = MusicXMLExporterSoftware::DOLET6; + else if (exporter.contains("dolet 8")) + _exporterSoftware = MusicXMLExporterSoftware::DOLET8; + else + _exporterSoftware = MusicXMLExporterSoftware::SIBELIUS; + } + else if (exporter.contains("finale")) + _exporterSoftware = MusicXMLExporterSoftware::FINALE; + else if (exporter.contains("noteflight")) + _exporterSoftware = MusicXMLExporterSoftware::NOTEFLIGHT; + } + //--------------------------------------------------------- // initPartState //--------------------------------------------------------- @@ -885,7 +901,7 @@ void MusicXMLParserPass1::createMeasuresAndVboxes(Score* const score, if (pageStartMeasureNrs.count(i) || i == 0) { ++pageNr; if (pageNr == 1) { - vbox = addCreditWords(score, crWords, pageSize, true, _exporterString.contains("sibelius")); + vbox = addCreditWords(score, crWords, pageSize, true, sibOrDolet()); //if (i == 0 && vbox) // vbox->setExcludeFromOtherParts(false); } @@ -908,10 +924,20 @@ void MusicXMLParserPass1::createMeasuresAndVboxes(Score* const score, // add a footer vbox if the next measure is on a new page or end of score has been reached if ((pageStartMeasureNrs.count(i + 1) || i == (ml.size() - 1)) && pageNr == 1) - addCreditWords(score, crWords, pageSize, false, _exporterString.contains("sibelius")); + addCreditWords(score, crWords, pageSize, false, sibOrDolet()); } } +bool MusicXMLParserPass1::sibOrDolet() const + { + return _exporterSoftware == MusicXMLExporterSoftware::SIBELIUS || dolet(); + } + +bool MusicXMLParserPass1::dolet() const + { + return _exporterSoftware == MusicXMLExporterSoftware::DOLET6 || _exporterSoftware == MusicXMLExporterSoftware::DOLET8; + } + //--------------------------------------------------------- // determineMeasureStart //--------------------------------------------------------- @@ -1242,8 +1268,10 @@ void MusicXMLParserPass1::identification() else if (_e.name() == "encoding") { // TODO while (_e.readNextStartElement()) { - if (_e.name() == "software") - _exporterString += _e.readElementText().toLower(); + if (_e.name() == "software") { + QString exporterString = _e.readElementText().toLower(); + setExporterSoftware(exporterString); + } else if (_e.name() == "supports" && _e.attributes().value("element") == "beam" && _e.attributes().value("type") == "yes") { _hasBeamingInfo = true; _e.skipCurrentElement(); @@ -2242,7 +2270,7 @@ void MusicXMLParserPass1::scoreInstrument(const QString& partId, const QString& */ // Finale exports all instrument names as 'Grand Piano' - use part name - if (_exporterString.contains("finale")) { + if (exporterSoftware() == MusicXMLExporterSoftware::FINALE) { instrName = _parts[partId].getName(); if (instrName.size() <= 1) instrName = curPartGroupName; diff --git a/importexport/musicxml/importmxmlpass1.h b/importexport/musicxml/importmxmlpass1.h index b8a9d76afdf23..bcbee85bd56dc 100644 --- a/importexport/musicxml/importmxmlpass1.h +++ b/importexport/musicxml/importmxmlpass1.h @@ -77,6 +77,15 @@ enum class MxmlTupletFlag : char { STOP_CURRENT = 8 }; +enum class MusicXMLExporterSoftware : char { + SIBELIUS, + DOLET6, + DOLET8, + FINALE, + NOTEFLIGHT, + OTHER + }; + typedef QFlags MxmlTupletFlags; struct MxmlTupletState { @@ -191,15 +200,18 @@ class MusicXMLParserPass1 { void addInferredTranspose(const QString& partId); void setHasInferredHeaderText(bool b) { _hasInferredHeaderText = b; } bool hasInferredHeaderText() const { return _hasInferredHeaderText; } - QString exporterString() const { return _exporterString; } + MusicXMLExporterSoftware exporterSoftware() const { return _exporterSoftware; } + bool sibOrDolet() const; + bool dolet() const; private: // functions void addError(const QString& error); ///< Add an error to be shown in the GUI + void setExporterSoftware(QString& exporter); // generic pass 1 data QXmlStreamReader _e; - QString _exporterString; ///< Name of the software which exported the file + MusicXMLExporterSoftware _exporterSoftware = MusicXMLExporterSoftware::OTHER; // Software which exported the file int _divs; ///< Current MusicXML divisions value QMap _parts; ///< Parts data, mapped on part id std::set _systemStartMeasureNrs; ///< Measure numbers of measures starting a page diff --git a/importexport/musicxml/importmxmlpass2.cpp b/importexport/musicxml/importmxmlpass2.cpp index efe541b220a45..45699884f137a 100644 --- a/importexport/musicxml/importmxmlpass2.cpp +++ b/importexport/musicxml/importmxmlpass2.cpp @@ -2298,7 +2298,7 @@ void MusicXMLParserPass2::part() // Clean up unterminated ties for (auto tie : _ties) { if (tie.second) { - cleanupUnterminatedTie(tie.second, _score, _pass1.exporterString().contains("dolet 6")); + cleanupUnterminatedTie(tie.second, _score, _pass1.exporterSoftware() == MusicXMLExporterSoftware::DOLET6); _ties[tie.first] = nullptr; } } @@ -3188,7 +3188,7 @@ void MusicXMLParserDirection::direction(const QString& partId, int track = _pass1.trackForPart(partId); bool isVocalStaff = _pass1.isVocalStaff(partId); bool isExpressionText = false; - bool delayOttava = _pass1.exporterString().contains("sibelius"); + bool delayOttava = _pass1.exporterSoftware() == MusicXMLExporterSoftware::SIBELIUS; _systemDirection = _e.attributes().value("system").toString() == "only-top"; //qDebug("direction track %d", track); QList starts; @@ -3463,21 +3463,25 @@ void MusicXMLParserDirection::direction(const QString& partId, } else { if (spdesc._isStarted) { + // Adjustments to ottavas by the offset value are unwanted + const Fraction spTick = spdesc._sp && spdesc._sp->isOttava() ? tick : tick + _offset; if (spdesc._sp && spdesc._sp->isOttava() && delayOttava) { // Sibelius writes ottava ends 1 note too early _pass2.setDelayedOttava(spdesc._sp); _pass2.delayedOttava()->setTrack2(track); - _pass2.delayedOttava()->setTick2(tick + _offset); + _pass2.delayedOttava()->setTick2(spTick); + // need to set tick again later _pass2.clearSpanner(desc); } else { - handleSpannerStop(spdesc._sp, track, tick + _offset, spanners); + handleSpannerStop(spdesc._sp, track, spTick, spanners); _pass2.clearSpanner(desc); } } else { spdesc._sp = desc._sp; - spdesc._tick2 = tick + _offset; + const Fraction spTick = spdesc._sp && spdesc._sp->isOttava() ? tick : tick + _offset; + spdesc._tick2 = spTick; spdesc._track2 = track; spdesc._isStopped = true; } @@ -3667,7 +3671,7 @@ void MusicXMLParserDirection::otherDirection() // TODO: Multiple sets of maps for exporters other than Dolet 6/Sibelius // TODO: Add more symbols from Sibelius QMap otherDirectionStrings; - if (_pass1.exporterString().contains("dolet")) { + if (_pass1.dolet()) { otherDirectionStrings = { { QString("To Coda"), QString("To Coda") }, { QString("Segno"), QString("segno") }, @@ -4479,12 +4483,20 @@ void MusicXMLParserDirection::octaveShift(const QString& type, const int number, else { Ottava* o = spdesc._isStopped ? toOttava(spdesc._sp) : new Ottava(_score); - // if (placement.isEmpty()) placement = "above"; // TODO ? set default - - if (type == "down" && ottavasize == 8) o->setOttavaType(OttavaType::OTTAVA_8VA); - if (type == "down" && ottavasize == 15) o->setOttavaType(OttavaType::OTTAVA_15MA); - if (type == "up" && ottavasize == 8) o->setOttavaType(OttavaType::OTTAVA_8VB); - if (type == "up" && ottavasize == 15) o->setOttavaType(OttavaType::OTTAVA_15MB); + if (type == "down") { + _placement = _placement.isEmpty() ? "above" : _placement; + if (ottavasize == 8) + o->setOttavaType(OttavaType::OTTAVA_8VA); + else if (ottavasize == 15) + o->setOttavaType(OttavaType::OTTAVA_15MA); + } + else /*if (type == "up")*/ { + _placement = _placement.isEmpty() ? "below" : _placement; + if (ottavasize == 8) + o->setOttavaType(OttavaType::OTTAVA_8VB); + else if (ottavasize == 15) + o->setOttavaType(OttavaType::OTTAVA_15MB); + } const QColor color { _e.attributes().value("color").toString() }; if (color.isValid()) @@ -6095,7 +6107,7 @@ Note* MusicXMLParserPass2::note(const QString& partId, QString noteheadValue = _e.readElementText(); if (noteheadValue == "none") hasHead = false; - else if (noteheadValue == "named" && _pass1.exporterString().contains("noteflight")) + else if (noteheadValue == "named" && _pass1.exporterSoftware() == MusicXMLExporterSoftware::NOTEFLIGHT) headScheme = NoteHead::Scheme::HEAD_PITCHNAME; else headGroup = convertNotehead(noteheadValue); @@ -6390,7 +6402,8 @@ Note* MusicXMLParserPass2::note(const QString& partId, Notation notation { "tied" }; const QString ctype { "type" }; notation.addAttribute(&ctype, &tieType); - addTie(notation, _score, note, cr->track(), _ties, _logger, &_e, _pass1.exporterString().contains("dolet 6")); + addTie(notation, _score, note, cr->track(), _ties, _logger, &_e, + _pass1.exporterSoftware() == MusicXMLExporterSoftware::DOLET6); } } @@ -7001,7 +7014,7 @@ void MusicXMLParserPass2::harmony(const QString& partId, Measure* measure, const const HarmonyDesc newHarmonyDesc(track, ha, fd); bool insert = true; - if (_pass1.exporterString().contains("dolet")) { + if (_pass1.sibOrDolet()) { const int ticks = (sTime + offset).ticks(); for (auto itr = harmonyMap.begin(); itr != harmonyMap.end(); itr++) { if (itr->first != ticks) @@ -8171,7 +8184,8 @@ void MusicXMLParserNotations::addToScore(ChordRest* const cr, Note* const note, addGlissandoSlide(notation, note, glissandi, spanners, _logger, &_e); } else if (note && notation.name() == "tied") { - addTie(notation, _score, note, cr->track(), ties, _logger, &_e, _pass1.exporterString().contains("dolet 6")); + addTie(notation, _score, note, cr->track(), ties, _logger, &_e, + _pass1.exporterSoftware() == MusicXMLExporterSoftware::DOLET6); } else if (note && notation.parent() == "technical") { addTechnical(notation, note); diff --git a/mtest/musicxml/io/testDoletOttavas.xml b/mtest/musicxml/io/testDoletOttavas.xml new file mode 100644 index 0000000000000000000000000000000000000000..9cb4976ee2d21fe1a433d0786c7cfbaa3f633079 GIT binary patch literal 10908 zcmd^_Yj0ac5Qg__k@yehQ$gY+P12+-a$Er^2vpjt7YT&;ki@w`;so1i8h$+RK0Ds* z?m2sG=T-_RYVDkzot^7Dvvcy-pI!IZy>mzI&~@Bfx8sIxb}#SjyP3rQ9m!WhD1Yu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{jfN* zrJ>KXdTe85I%+Z@oD^h>yxnbmTLA!=C@vMo1)q@W=&B7=hA8}sbORux!9cPEYk*?(-?x} z&r&|@I1)ZlA$$6^sp>=>Muzx2-N8!fZ0>zllbbS;h1digZR(OfNx36WSgW+dW}Nk1 z=}NjA*~(IMRdMYW-jt4>Y|rEEw_fk~d&(QhLU&K!&sp*Jl#-RwX*{158BF*NJc7|7 z)aUCla=^Gq(Pj^1KK69n{H*`n7gypV?-l!^JChBVfQBBG{^X&5Qo_=XkD1t2Rg<2N z$sk;iklaBFJNuo-;Yv5bv_CVnz&1_I%X*b*Q@?hliFMrRQ>;NBF_uM`0;WD=4XoS| zMNjXRI3xaEr%Y`c?&$fmbO*fJ&c)wUEVGlnO<9rEElZkfIbV7R-o@CghI7&({#y}Eyz`Bp!nNm0&7!=*F>xapRWhNxmbcp0Q=!xE-S*TWJ+NTwjX`Jxl#EgtiD z>(Y5&8Q1ctZ(1j{-#>-qStN8ge|v)PNZ*VMp630#`R~KH$6||Iy5=pFj7noJSeOc*d$g^i z;1u)Up + + + + 0 + 480 + + 1 + 1 + 1 + 0 + + + + + + + + + + + + + + + stdNormal + + 3 + + [Unnamed (treble staff)] + + + 21 + 108 + 21 + 108 + keyboard.piano.grand + F + 0 + + 100 + 95 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + + + + + 10 + + + + + G + G + + + 4 + 4 + + + + 8va + + + + 1/2 + + + + + eighth + up + + 65 + 13 + + + + 1 + quarter + up + + 65 + 13 + + + + + + -1/2 + + + + + + 8vb + + + + 1 + + + + + half + up + + + + + + + 1 + -1/2 + + + + 65 + 13 + + + + + + + + quarter + up + + + + + -1 + 1/2 + + + + 65 + 13 + + + + quarter + up + + 65 + 13 + + + + + + -1 + + + + + half + + + end + + + + + + diff --git a/mtest/musicxml/io/testSibOttavas.xml b/mtest/musicxml/io/testSibOttav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CVnz&1_I%X*b*Q@?hliFMrRQ>;NBF_uM`0;WD=4XoS| zMNjXRI3xaEr%Y`c?&$fmbO*fJ&c)wUEVGlnO<9rEElZkfIbV7R-o@CghI7&({#y}Eyz`Bp!nNm0&7!=*F>xapRWhNxmbcp0Q=!xE-S*TWJ+NTwjX`Jxl#EgtiD z>(Y5&8Q1ctZ(1j{-#>-qStN8ge|v)PNZ*VMp630#`R~KH$6||Iy5=pFj7noJSeOc*d$g^i z;1u)Up0 480 1 1 @@ -51,19 +104,14 @@ 3 - [Unnamed (treble staff)] - - - 21 - 108 - 21 - 108 - keyboard.piano.grand - F - 0 + + + + + 100 - 95 + 100 100 @@ -110,6 +158,9 @@ 10 + + page + @@ -132,6 +183,7 @@ + no eighth up @@ -144,7 +196,7 @@ quarter up - 65 + 77 13 @@ -171,6 +223,7 @@ + down @@ -207,7 +260,7 @@ quarter up - 65 + 53 13 diff --git a/mtest/musicxml/io/tst_mxml_io.cpp b/mtest/musicxml/io/tst_mxml_io.cpp index 78a55a36feda3..bf2cda39f4e0a 100644 --- a/mtest/musicxml/io/tst_mxml_io.cpp +++ b/mtest/musicxml/io/tst_mxml_io.cpp @@ -114,6 +114,7 @@ private slots: void divisionsDefinedTooLate1() { mxmlIoTestRef("testDivsDefinedTooLate1"); } void divisionsDefinedTooLate2() { mxmlIoTestRef("testDivsDefinedTooLate2"); } void divisionsDuration() { mxmlIoTest("testDivisionsDuration"); } + void doletOttavas() { mxmlImportTestRef("testDoletOttavas"); } void doubleClefError() { mxmlIoTestRef("testDoubleClefError"); } void drumset1() { mxmlIoTest("testDrumset1"); } void drumset2() { mxmlIoTest("testDrumset2"); }