From 9beeb79a5a55ef30182e1e88c07eb894a3101087 Mon Sep 17 00:00:00 2001 From: ajuncosa Date: Mon, 13 Jul 2026 18:28:52 +0200 Subject: [PATCH 1/2] Fix musicXML imports containing start-end repeat barlines from Noteflight --- .../musicxml/internal/import/importmusicxmlpass2.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/importexport/musicxml/internal/import/importmusicxmlpass2.cpp b/src/importexport/musicxml/internal/import/importmusicxmlpass2.cpp index 96987e7eb0ca8..8ed48de7a6ac8 100644 --- a/src/importexport/musicxml/internal/import/importmusicxmlpass2.cpp +++ b/src/importexport/musicxml/internal/import/importmusicxmlpass2.cpp @@ -5672,7 +5672,8 @@ String MusicXmlParserDirection::metronome(double& r) //--------------------------------------------------------- static bool determineBarLineType(const String& barStyle, const String& repeat, - BarLineType& type, bool& visible) + BarLineType& type, bool& visible, + const MusicXmlExporterSoftware& exporter) { // set defaults type = BarLineType::NORMAL; @@ -5682,6 +5683,8 @@ static bool determineBarLineType(const String& barStyle, const String& repeat, type = BarLineType::END_REPEAT; } else if (barStyle == u"heavy-light" && repeat == u"forward") { type = BarLineType::START_REPEAT; + } else if (barStyle == u"light-heavy" && repeat == u"forward" && exporter == MusicXmlExporterSoftware::NOTEFLIGHT) { + type = BarLineType::START_REPEAT; } else if (barStyle == u"light-heavy" && repeat.empty()) { type = BarLineType::END; } else if (barStyle == u"heavy-light" && repeat.empty()) { @@ -5872,7 +5875,7 @@ void MusicXmlParserPass2::barline(const String& partId, Measure* measure, const BarLineType type = BarLineType::NORMAL; bool visible = true; - if (determineBarLineType(barStyle, repeat, type, visible)) { + if (determineBarLineType(barStyle, repeat, type, visible, m_pass1.exporterSoftware())) { const track_idx_t track = m_pass1.trackForPart(partId); if (type & BarLineType::START_REPEAT) { // combine start_repeat flag with current state initialized during measure parsing From ddd88d34500ab54ff1a4dd4bdebdec65b34d3ebe Mon Sep 17 00:00:00 2001 From: ajuncosa Date: Mon, 13 Jul 2026 19:19:08 +0200 Subject: [PATCH 2/2] Add unit test for Noteflight start-end repeat barlines --- .../data/testNoteflightStartRepeatBarline.xml | 140 ++++++++++++ .../testNoteflightStartRepeatBarline_ref.mscx | 204 ++++++++++++++++++ .../musicxml/tests/musicxml_tests.cpp | 3 + 3 files changed, 347 insertions(+) create mode 100644 src/importexport/musicxml/tests/data/testNoteflightStartRepeatBarline.xml create mode 100644 src/importexport/musicxml/tests/data/testNoteflightStartRepeatBarline_ref.mscx diff --git a/src/importexport/musicxml/tests/data/testNoteflightStartRepeatBarline.xml b/src/importexport/musicxml/tests/data/testNoteflightStartRepeatBarline.xml new file mode 100644 index 0000000000000..8c90eeb92bb53 --- /dev/null +++ b/src/importexport/musicxml/tests/data/testNoteflightStartRepeatBarline.xml @@ -0,0 +1,140 @@ + + + + + Untitled score + + + Composer / arranger + + Noteflight version 0.4 + 2026-07-06 + + + + + + + 1.411111112 + 10 + + + 1980 + 1530 + + 89.375 + 85 + 145 + 120 + + + + + 89.375 + 40 + + 130 + 210 + + + 65 + + + + title + + Untitled score + + + + composer + + Composer / arranger + + + + + Violin + Vln. + + Violin + strings.violin + + + 1 + 41 + + + + + + + 64 + + 0 + major + + + + G + 2 + + + + + F + 5 + + 1 + 1 + quarter + + + + G + 5 + + 1 + 1 + quarter + + + light-heavy + + + + + + + light-heavy + + + + + + A + 5 + + 1 + 1 + quarter + + + + B + 5 + + 1 + 1 + quarter + + + light-heavy + + + + + diff --git a/src/importexport/musicxml/tests/data/testNoteflightStartRepeatBarline_ref.mscx b/src/importexport/musicxml/tests/data/testNoteflightStartRepeatBarline_ref.mscx new file mode 100644 index 0000000000000..b974c0ac7bb8d --- /dev/null +++ b/src/importexport/musicxml/tests/data/testNoteflightStartRepeatBarline_ref.mscx @@ -0,0 +1,204 @@ + + + + B_B + 480 + + 1 + 1 + 1 + 0 + + Composer / arranger + + + + + + + + Untitled score + + C_C + + D_D + + stdNormal + + + + + Violin + Vln. + + Violin + 55 + 103 + 55 + 88 + strings.violin + portamento + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + + + + + + + + + + + 10 + E_E + + F_F + +
Untitled score
+
+ + G_G + +
Composer / arranger
+
+
+ + H_H + 2 + + + G + G + 1 + I_I + + + J_J + 2 + 4 + + + K_K + quarter + + L_L + + + 15 + + + 77 + 13 + + + + M_M + quarter + + N_N + + + 15 + + + 79 + 15 + + + + + + O_O + + 2 + + + P_P + quarter + + Q_Q + + + 15 + + + 81 + 17 + + + + R_R + quarter + + S_S + + + 15 + + + 83 + 19 + + + + +
+
+
diff --git a/src/importexport/musicxml/tests/musicxml_tests.cpp b/src/importexport/musicxml/tests/musicxml_tests.cpp index 380d4f7d85fb6..4e80672ae1d73 100644 --- a/src/importexport/musicxml/tests/musicxml_tests.cpp +++ b/src/importexport/musicxml/tests/musicxml_tests.cpp @@ -401,6 +401,9 @@ TEST_F(MusicXml_Tests, barlineFermatas) { TEST_F(MusicXml_Tests, barlineLoc) { musicXmlImportTestRef("testBarlineLoc"); } +TEST_F(MusicXml_Tests, noteflightStartRepeatBarline) { + musicXmlImportTestRef("testNoteflightStartRepeatBarline"); +} TEST_F(MusicXml_Tests, barlineSpan) { musicXmlIoTest("testBarlineSpan"); }