diff --git a/src/importexport/musicxml/internal/export/exportmusicxml.cpp b/src/importexport/musicxml/internal/export/exportmusicxml.cpp
index 5997e3532549d..01c6dbf531180 100644
--- a/src/importexport/musicxml/internal/export/exportmusicxml.cpp
+++ b/src/importexport/musicxml/internal/export/exportmusicxml.cpp
@@ -1675,6 +1675,8 @@ static void pitch2xml(const Note* note, String& s, int& alter, int& octave)
// correct for ottava lines
int ottava = 0;
switch (note->ppitch() - note->pitch()) {
+ case 36: ottava = 3;
+ break;
case 24: ottava = 2;
break;
case 12: ottava = 1;
@@ -1685,6 +1687,8 @@ static void pitch2xml(const Note* note, String& s, int& alter, int& octave)
break;
case -24: ottava = -2;
break;
+ case -36: ottava = -3;
+ break;
default: LOGD("pitch2xml() tick=%d pitch()=%d ppitch()=%d",
tick.ticks(), note->pitch(), note->ppitch());
}
@@ -5648,6 +5652,10 @@ void ExportMusicXml::ottava(Ottava const* const ot, staff_idx_t staff, const Fra
sz = u"15";
tp = u"down";
break;
+ case OttavaType::OTTAVA_22MA:
+ sz = u"22";
+ tp = u"down";
+ break;
case OttavaType::OTTAVA_8VB:
sz = u"8";
tp = u"up";
@@ -5656,6 +5664,10 @@ void ExportMusicXml::ottava(Ottava const* const ot, staff_idx_t staff, const Fra
sz = u"15";
tp = u"up";
break;
+ case OttavaType::OTTAVA_22MB:
+ sz = u"22";
+ tp = u"up";
+ break;
default:
LOGD("ottava subtype %d not understood", int(st));
}
@@ -5667,6 +5679,8 @@ void ExportMusicXml::ottava(Ottava const* const ot, staff_idx_t staff, const Fra
octaveShiftXml = String(u"octave-shift type=\"stop\" size=\"8\" number=\"%1\"").arg(n + 1);
} else if (st == OttavaType::OTTAVA_15MA || st == OttavaType::OTTAVA_15MB) {
octaveShiftXml = String(u"octave-shift type=\"stop\" size=\"15\" number=\"%1\"").arg(n + 1);
+ } else if (st == OttavaType::OTTAVA_22MA || st == OttavaType::OTTAVA_22MB) {
+ octaveShiftXml = String(u"octave-shift type=\"stop\" size=\"22\" number=\"%1\"").arg(n + 1);
} else {
LOGD("ottava subtype %d not understood", int(st));
}
@@ -5677,7 +5691,7 @@ void ExportMusicXml::ottava(Ottava const* const ot, staff_idx_t staff, const Fra
const Fraction tickToWrite = isStart ? ot->tick() : ot->tick2();
moveToTickIfNeed(tickToWrite, ot->track(), measureStart);
- directionTag(m_xml, m_attr, ot);
+ directionTag(m_xml, m_attr, nullptr);
m_xml.startElement("direction-type");
octaveShiftXml += color2xml(ot);
octaveShiftXml += positioningAttributes(ot, ot->tick() == tick);
diff --git a/src/importexport/musicxml/internal/import/importmusicxmlpass1.cpp b/src/importexport/musicxml/internal/import/importmusicxmlpass1.cpp
index 784ac1f009345..b77836c12ac00 100644
--- a/src/importexport/musicxml/internal/import/importmusicxmlpass1.cpp
+++ b/src/importexport/musicxml/internal/import/importmusicxmlpass1.cpp
@@ -3287,13 +3287,13 @@ void MusicXmlParserPass1::handleOctaveShift(const Fraction& cTime,
short sz = 0;
switch (size) {
- case 8: sz = 1;
+ case 22: sz = 3;
break;
- case 15: sz = 2;
+ case 15: sz = 2;
break;
+ case 8:
default:
- m_logger->logError(String(u"invalid octave-shift size %1").arg(size), &m_e);
- return;
+ sz = 1;
}
if (!cTime.isValid() || cTime < Fraction(0, 1)) {
diff --git a/src/importexport/musicxml/internal/import/importmusicxmlpass2.cpp b/src/importexport/musicxml/internal/import/importmusicxmlpass2.cpp
index 96987e7eb0ca8..9b72f58d79a49 100644
--- a/src/importexport/musicxml/internal/import/importmusicxmlpass2.cpp
+++ b/src/importexport/musicxml/internal/import/importmusicxmlpass2.cpp
@@ -5286,7 +5286,7 @@ void MusicXmlParserDirection::octaveShift(const String& type, const int number,
return;
}
int ottavasize = m_e.intAttribute("size");
- if (!(ottavasize == 8 || ottavasize == 15)) {
+ if (!(ottavasize == 8 || ottavasize == 15 || ottavasize == 22)) {
m_logger->logError(String(u"unknown octave-shift size %1").arg(ottavasize), &m_e);
} else {
Ottava* o = spdesc.isStopped ? toOttava(spdesc.sp) : Factory::createOttava(m_score->dummy());
@@ -5297,6 +5297,8 @@ void MusicXmlParserDirection::octaveShift(const String& type, const int number,
o->setOttavaType(OttavaType::OTTAVA_8VA);
} else if (ottavasize == 15) {
o->setOttavaType(OttavaType::OTTAVA_15MA);
+ } else if (ottavasize == 22) {
+ o->setOttavaType(OttavaType::OTTAVA_22MA);
}
} else if (type == u"up") {
m_placement = m_placement.empty() ? u"below" : m_placement;
@@ -5304,6 +5306,8 @@ void MusicXmlParserDirection::octaveShift(const String& type, const int number,
o->setOttavaType(OttavaType::OTTAVA_8VB);
} else if (ottavasize == 15) {
o->setOttavaType(OttavaType::OTTAVA_15MB);
+ } else if (ottavasize == 22) {
+ o->setOttavaType(OttavaType::OTTAVA_22MB);
}
}
diff --git a/src/importexport/musicxml/tests/data/testColorExport_ref.xml b/src/importexport/musicxml/tests/data/testColorExport_ref.xml
index 46efef2327e1a..3592b430f2db0 100644
--- a/src/importexport/musicxml/tests/data/testColorExport_ref.xml
+++ b/src/importexport/musicxml/tests/data/testColorExport_ref.xml
@@ -274,7 +274,7 @@
Ausdruck
-
+
@@ -363,7 +363,7 @@
1
quarter
-
+
diff --git a/src/importexport/musicxml/tests/data/testExcludeInvisibleElements_invisible_ref.xml b/src/importexport/musicxml/tests/data/testExcludeInvisibleElements_invisible_ref.xml
index e3a84495d7978..e1a2f2bfbaca7 100644
--- a/src/importexport/musicxml/tests/data/testExcludeInvisibleElements_invisible_ref.xml
+++ b/src/importexport/musicxml/tests/data/testExcludeInvisibleElements_invisible_ref.xml
@@ -523,7 +523,7 @@
-
+
@@ -568,14 +568,14 @@
quarter
up
-
+
-
+
@@ -620,7 +620,7 @@
quarter
up
-
+
diff --git a/src/importexport/musicxml/tests/data/testExcludeInvisibleElements_noinvisible_ref.xml b/src/importexport/musicxml/tests/data/testExcludeInvisibleElements_noinvisible_ref.xml
index c89c88a967b73..2598348934493 100644
--- a/src/importexport/musicxml/tests/data/testExcludeInvisibleElements_noinvisible_ref.xml
+++ b/src/importexport/musicxml/tests/data/testExcludeInvisibleElements_noinvisible_ref.xml
@@ -474,7 +474,7 @@
-
+
@@ -519,7 +519,7 @@
quarter
up
-
+
diff --git a/src/importexport/musicxml/tests/data/testLayout.xml b/src/importexport/musicxml/tests/data/testLayout.xml
index 9673172815544..bb6e00d9c87eb 100644
--- a/src/importexport/musicxml/tests/data/testLayout.xml
+++ b/src/importexport/musicxml/tests/data/testLayout.xml
@@ -119,7 +119,7 @@
4
-
+
@@ -177,7 +177,7 @@
down
2
-
+
diff --git a/src/importexport/musicxml/tests/data/testLines1.xml b/src/importexport/musicxml/tests/data/testLines1.xml
index 2e1fee258214d..254c699b83eca 100644
--- a/src/importexport/musicxml/tests/data/testLines1.xml
+++ b/src/importexport/musicxml/tests/data/testLines1.xml
@@ -59,7 +59,7 @@
quarter
up
-
+
@@ -84,7 +84,7 @@
quarter
up
-
+
@@ -111,7 +111,7 @@
quarter
down
-
+
@@ -136,7 +136,7 @@
quarter
down
-
+
@@ -163,7 +163,7 @@
quarter
up
-
+
@@ -198,7 +198,7 @@
quarter
up
-
+
@@ -215,7 +215,7 @@
quarter
down
-
+
@@ -250,7 +250,7 @@
quarter
down
-
+
diff --git a/src/importexport/musicxml/tests/data/testOctaveShift.xml b/src/importexport/musicxml/tests/data/testOctaveShift.xml
new file mode 100644
index 0000000000000..2bd2fae1bfddd
--- /dev/null
+++ b/src/importexport/musicxml/tests/data/testOctaveShift.xml
@@ -0,0 +1,785 @@
+
+
+
+
+ All octave-shifts
+
+
+
+ Klaus Rettinghaus
+ MuseScore 0.7.0
+ 2007-09-10
+
+
+
+
+
+
+
+
+
+ Piano
+
+ Piano
+
+
+
+ 1
+ 1
+ 78.7402
+ 0
+
+
+
+
+
+
+ 1
+
+ 0
+
+
+
+ G
+ 2
+
+
+
+
+ C
+ 4
+
+ 1
+ 1
+ quarter
+ up
+
+
+
+ D
+ 4
+
+ 1
+ 1
+ quarter
+ up
+
+
+
+ E
+ 4
+
+ 1
+ 1
+ quarter
+ up
+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+
+
+
+ E
+ 1
+
+ 1
+ 1
+ quarter
+ up
+
+
+
+ D
+ 1
+
+ 1
+ 1
+ quarter
+ up
+
+
+
+
+
+
+
+
+
+
+ C
+ 4
+
+ 1
+ 1
+ quarter
+ up
+
+
+
+ D
+ 4
+
+ 1
+ 1
+ quarter
+ up
+
+
+
+ E
+ 4
+
+ 1
+ 1
+ quarter
+ up
+
+
+
+ F
+ 4
+
+ 1
+ 1
+ quarter
+ up
+
+
+
+
+
+ G
+ 4
+
+ 1
+ 1
+ quarter
+ up
+
+
+
+ F
+ 4
+
+ 1
+ 1
+ quarter
+ up
+
+
+
+ E
+ 4
+
+ 1
+ 1
+ quarter
+ up
+
+
+
+ D
+ 4
+
+ 1
+ 1
+ quarter
+ up
+
+
+ light-heavy
+
+
+
+
diff --git a/src/importexport/musicxml/tests/data/testOverlappingSpanners.xml b/src/importexport/musicxml/tests/data/testOverlappingSpanners.xml
index 9e51af5542079..3b2e00ee40bbc 100644
--- a/src/importexport/musicxml/tests/data/testOverlappingSpanners.xml
+++ b/src/importexport/musicxml/tests/data/testOverlappingSpanners.xml
@@ -286,7 +286,7 @@
up
1
-
+
@@ -328,7 +328,7 @@
down
2
-
+
@@ -391,7 +391,7 @@
up
1
-
+
@@ -433,7 +433,7 @@
down
2
-
+
diff --git a/src/importexport/musicxml/tests/data/testTimeTickExport_ref.xml b/src/importexport/musicxml/tests/data/testTimeTickExport_ref.xml
index a249682dd8d23..379fb060854f2 100644
--- a/src/importexport/musicxml/tests/data/testTimeTickExport_ref.xml
+++ b/src/importexport/musicxml/tests/data/testTimeTickExport_ref.xml
@@ -85,7 +85,7 @@
-
+
@@ -140,7 +140,7 @@
whole
1
-
+
diff --git a/src/importexport/musicxml/tests/musicxml_tests.cpp b/src/importexport/musicxml/tests/musicxml_tests.cpp
index 380d4f7d85fb6..13536bc1b33a0 100644
--- a/src/importexport/musicxml/tests/musicxml_tests.cpp
+++ b/src/importexport/musicxml/tests/musicxml_tests.cpp
@@ -1087,6 +1087,9 @@ TEST_F(MusicXml_Tests, numberedLyrics) {
TEST_F(MusicXml_Tests, numerals) {
musicXmlIoTest("testNumerals");
}
+TEST_F(MusicXml_Tests, octaveShift) {
+ musicXmlIoTest("testOctaveShift");
+}
TEST_F(MusicXml_Tests, ornaments) {
musicXmlIoTest("testOrnaments");
}