From f0ebcac35f4634966a637888a4b7b3f7d6f73ae1 Mon Sep 17 00:00:00 2001 From: iveshenry18 Date: Thu, 29 Jul 2021 22:03:52 -0600 Subject: [PATCH] ENG-78: fix wedges with values Previously, the element was not correctly applied to any spanners in elements. This commit fixes that and adjusts the applicable tests accordingly. --- importexport/musicxml/importmxmlpass2.cpp | 12 +- .../io/testBackupRoundingError_ref.mscx | 46 +- mtest/musicxml/io/testWedgeOffset.xml | 1550 +++++++++++++++++ mtest/musicxml/io/testWedgeOffset_ref.mscx | 1109 ++++++++++++ mtest/musicxml/io/tst_mxml_io.cpp | 1 + 5 files changed, 2682 insertions(+), 36 deletions(-) create mode 100644 mtest/musicxml/io/testWedgeOffset.xml create mode 100644 mtest/musicxml/io/testWedgeOffset_ref.mscx diff --git a/importexport/musicxml/importmxmlpass2.cpp b/importexport/musicxml/importmxmlpass2.cpp index 5f14b18a8c231..79a7bcb80253e 100644 --- a/importexport/musicxml/importmxmlpass2.cpp +++ b/importexport/musicxml/importmxmlpass2.cpp @@ -3064,7 +3064,7 @@ void MusicXMLParserDirection::direction(const QString& partId, } // handle the spanner stops first - foreach (auto desc, stops) { + for (auto desc : stops) { auto& spdesc = _pass2.getSpanner({ desc._tp, desc._nr }); if (spdesc._isStopped) { _logger->logError("spanner already stopped", &_e); @@ -3072,12 +3072,12 @@ void MusicXMLParserDirection::direction(const QString& partId, } else { if (spdesc._isStarted) { - handleSpannerStop(spdesc._sp, track, tick, spanners); + handleSpannerStop(spdesc._sp, track, tick + _offset, spanners); _pass2.clearSpanner(desc); } else { spdesc._sp = desc._sp; - spdesc._tick2 = tick; + spdesc._tick2 = tick + _offset; spdesc._track2 = track; spdesc._isStopped = true; } @@ -3086,7 +3086,7 @@ void MusicXMLParserDirection::direction(const QString& partId, // then handle the spanner starts // TBD handle offset ? - foreach (auto desc, starts) { + for (auto desc : starts) { auto& spdesc = _pass2.getSpanner({ desc._tp, desc._nr }); if (spdesc._isStarted) { _logger->logError("spanner already started", &_e); @@ -3097,13 +3097,13 @@ void MusicXMLParserDirection::direction(const QString& partId, _pass2.addSpanner(desc); // handleSpannerStart and handleSpannerStop must be called in order // due to allocation of elements in the map - handleSpannerStart(desc._sp, track, placement(), tick, spanners); + handleSpannerStart(desc._sp, track, placement(), tick + _offset, spanners); handleSpannerStop(spdesc._sp, spdesc._track2, spdesc._tick2, spanners); _pass2.clearSpanner(desc); } else { _pass2.addSpanner(desc); - handleSpannerStart(desc._sp, track, placement(), tick, spanners); + handleSpannerStart(desc._sp, track, placement(), tick + _offset, spanners); spdesc._isStarted = true; } } diff --git a/mtest/musicxml/io/testBackupRoundingError_ref.mscx b/mtest/musicxml/io/testBackupRoundingError_ref.mscx index 24ae794474cdc..714adf9355ae3 100644 --- a/mtest/musicxml/io/testBackupRoundingError_ref.mscx +++ b/mtest/musicxml/io/testBackupRoundingError_ref.mscx @@ -705,7 +705,7 @@ - 11/24 + 1/6 @@ -745,6 +745,13 @@ 14 + + + + -1/6 + + + mid 1 @@ -783,19 +790,6 @@ 20 - - -1/4 - - - - - -11/24 - - - - - 1/4 - no 1 @@ -1757,20 +1751,19 @@ 20 + + -1/8 + + + + + 1/8 + fermataBelow below - - 1 - <sym>keyboardPedalPed</sym> - - - - 1/4 - - quarter @@ -1800,13 +1793,6 @@ fermataAbove - - - - -1/4 - - - eighth diff --git a/mtest/musicxml/io/testWedgeOffset.xml b/mtest/musicxml/io/testWedgeOffset.xml new file mode 100644 index 0000000000000..de49f5e927a91 --- /dev/null +++ b/mtest/musicxml/io/testWedgeOffset.xml @@ -0,0 +1,1550 @@ + + + + + Wedge Offsets + + + Henry Ives + + MuseScore 0.7.0 + 2007-09-10 + + + + + + + + + + 7 + 40 + + + 1697.14 + 1200 + + 85.7143 + 85.7143 + 85.7143 + 85.7143 + + + 85.7143 + 85.7143 + 85.7143 + 85.7143 + + + + + + + title + Wedge Offsets + + + subtitle + MuseScore Testcase + + + composer + Henry Ives + + + + brace + + + Piano + Pno. + + Piano + + + + 1 + 1 + 78.7402 + 0 + + + + + + + + + 50.00 + 0.00 + + 170.00 + + + + 4 + + 0 + + + + G + 2 + + + + + G + 4 + + 1 + 1 + 16th + down + begin + begin + + + + D + 5 + + 1 + 1 + 16th + down + continue + continue + + + + C + 5 + + 1 + 1 + 16th + down + continue + continue + + + + B + 4 + + 1 + 1 + 16th + down + end + end + + + + A + 4 + + 1 + 1 + 16th + down + + + + + B + 4 + + 1 + 1 + 16th + down + + + + + D + 5 + + 1 + 1 + 16th + down + + + + 1 + 1 + 16th + + + + B + 4 + + 1 + 1 + 16th + down + begin + begin + + + + + C + 5 + + 1 + 1 + 16th + down + + + + + D + 5 + + 1 + 1 + 16th + down + + + + + E + 5 + + 1 + 1 + 16th + down + + + + + F + 5 + + 1 + 1 + 16th + down + + + + A + 4 + + 1 + 1 + 16th + down + end + end + + + + E + 4 + + 1 + 1 + 16th + up + begin + begin + + + + + B + 4 + + 1 + 1 + 16th + up + + + + + D + 5 + + 1 + 1 + 16th + up + + + + B + 4 + + 1 + 1 + 16th + up + continue + continue + + + + B + 4 + + 1 + 1 + 16th + up + continue + continue + + + + + C + 5 + + 1 + 1 + 16th + up + + + + + D + 5 + + 1 + 1 + 16th + up + + + + + E + 5 + + 1 + 1 + 16th + up + + + + A + 4 + + 1 + 1 + 16th + up + end + end + + + + + B + 4 + + 1 + 1 + 16th + up + + + + B + 4 + + 1 + 1 + 16th + down + + + + + F + 5 + + 1 + 1 + 16th + down + + + + 1 + 1 + 16th + + + + B + 4 + + 1 + 1 + 16th + down + begin + begin + + + + G + 4 + + 1 + 1 + 16th + down + end + end + + + + + A + 4 + + 1 + 1 + 16th + down + + + + + D + 5 + + 1 + 1 + 16th + down + + + + + E + 5 + + 1 + 1 + 16th + down + + + + + + A + 4 + + 1 + 1 + 16th + down + begin + begin + + + + B + 4 + + 1 + 1 + 16th + down + continue + continue + + + + B + 4 + + 1 + 1 + 16th + down + continue + continue + + + + + C + 5 + + 1 + 1 + 16th + down + + + + A + 4 + + 1 + 1 + 16th + down + end + end + + + + + C + 5 + + 1 + 1 + 16th + down + + + + + + -4 + + + + D + 4 + + 1 + 1 + 16th + down + + + + + E + 4 + + 1 + 1 + 16th + down + + + + + A + 4 + + 1 + 1 + 16th + down + + + + + D + 5 + + 1 + 1 + 16th + down + + + + + B + 5 + + 1 + 1 + 16th + down + + + + 1 + 1 + 16th + + + + B + 4 + + 1 + 1 + 16th + down + begin + begin + + + + D + 5 + + 1 + 1 + 16th + down + end + end + + + + + + + + + + + + + + A + 4 + + 1 + 1 + 16th + down + begin + begin + + + + + E + 5 + + 1 + 1 + 16th + down + + + + G + 4 + + 1 + 1 + 16th + down + continue + continue + + + + + B + 4 + + 1 + 1 + 16th + down + + + + + C + 5 + + 1 + 1 + 16th + down + + + + + A + 5 + + 1 + 1 + 16th + down + + + + C + 4 + + 1 + 1 + 16th + down + end + end + + + + + D + 5 + + 1 + 1 + 16th + down + + + + 1 + 1 + 16th + + + + F + 4 + + 1 + 1 + 16th + down + begin + begin + + + + + C + 5 + + 1 + 1 + 16th + down + + + + + E + 5 + + 1 + 1 + 16th + down + + + + C + 5 + + 1 + 1 + 16th + down + continue + continue + + + + + + 2 + + + + G + 4 + + 1 + 1 + 16th + down + end + end + + + + + C + 5 + + 1 + 1 + 16th + down + + + + 1 + 1 + 16th + + + + + + D + 5 + + 1 + 1 + 16th + down + begin + begin + + + + E + 5 + + 1 + 1 + 16th + down + continue + continue + + + + G + 4 + + 1 + 1 + 16th + down + continue + continue + + + + + C + 5 + + 1 + 1 + 16th + down + + + + D + 5 + + 1 + 1 + 16th + down + end + end + + + + + G + 5 + + 1 + 1 + 16th + down + + + + C + 5 + + 1 + 1 + 16th + down + begin + begin + + + + E + 5 + + 1 + 1 + 16th + down + continue + continue + + + + A + 5 + + 1 + 1 + 16th + down + continue + continue + + + + C + 5 + + 1 + 1 + 16th + down + end + end + + + + C + 5 + + 1 + 1 + 16th + down + begin + begin + + + + + D + 5 + + 1 + 1 + 16th + down + + + + + F + 5 + + 1 + 1 + 16th + down + + + + D + 5 + + 1 + 1 + 16th + down + continue + continue + + + + D + 5 + + 1 + 1 + 16th + down + end + end + + + + 1 + 1 + 16th + + + + B + 4 + + 1 + 1 + 16th + down + begin + begin + + + + + E + 5 + + 1 + 1 + 16th + down + + + + C + 5 + + 1 + 1 + 16th + down + continue + continue + + + + + E + 5 + + 1 + 1 + 16th + down + + + + D + 5 + + 1 + 1 + 16th + down + end + end + + + + + E + 5 + + 1 + 1 + 16th + down + + + + 1 + 1 + 16th + + + + + + + + 4 + + + + D + 5 + + 1 + 1 + 16th + down + begin + begin + + + + + G + 5 + + 1 + 1 + 16th + down + + + + B + 4 + + 1 + 1 + 16th + down + continue + continue + + + + + C + 5 + + 1 + 1 + 16th + down + + + + C + 5 + + 1 + 1 + 16th + down + continue + continue + + + + B + 4 + + 1 + 1 + 16th + down + end + end + + + + + G + 5 + + 1 + 1 + 16th + down + + + + D + 5 + + 1 + 1 + 16th + down + begin + begin + + + + C + 5 + + 1 + 1 + 16th + down + end + end + + + + 2 + 1 + eighth + + + + D + 5 + + 1 + 1 + 16th + down + begin + begin + + + + B + 4 + + 1 + 1 + 16th + down + continue + continue + + + + A + 4 + + 1 + 1 + 16th + down + continue + continue + + + + B + 4 + + 1 + 1 + 16th + down + end + end + + + + + D + 5 + + 1 + 1 + 16th + down + + + + + F + 5 + + 1 + 1 + 16th + down + + + + D + 5 + + 1 + 1 + 16th + down + + + + 1 + 1 + 16th + + + + D + 5 + + 1 + 1 + 16th + down + begin + begin + + + + A + 4 + + 1 + 1 + 16th + down + end + end + + + + + F + 5 + + 1 + 1 + 16th + down + + + + + + + + + + + B + 4 + + 1 + 1 + 16th + down + begin + begin + + + + + C + 5 + + 1 + 1 + 16th + down + + + + A + 4 + + 1 + 1 + 16th + down + continue + continue + + + + B + 4 + + 1 + 1 + 16th + down + end + end + + + + + C + 5 + + 1 + 1 + 16th + down + + + + 1 + 1 + 16th + + + + A + 4 + + 1 + 1 + 16th + down + + + + + D + 5 + + 1 + 1 + 16th + down + + + + + F + 5 + + 1 + 1 + 16th + down + + + + 1 + 1 + 16th + + + + C + 5 + + 1 + 1 + 16th + down + begin + begin + + + + C + 5 + + 1 + 1 + 16th + down + end + end + + + + A + 4 + + 1 + 1 + 16th + down + + + + + F + 5 + + 1 + 1 + 16th + down + + + + 1 + 1 + 16th + + + + + + + + + C + 5 + + 1 + 1 + 16th + down + + + + 1 + 1 + 16th + + + + C + 5 + + 1 + 1 + 16th + down + + + + 1 + 1 + 16th + + + + 2 + 1 + eighth + + + + + + E + 5 + + 1 + 1 + 16th + down + + + + 1 + 1 + 16th + + + + + + -2 + + + + 2 + 1 + eighth + + + + 4 + 1 + quarter + + + + 8 + 1 + half + + + light-heavy + + + + diff --git a/mtest/musicxml/io/testWedgeOffset_ref.mscx b/mtest/musicxml/io/testWedgeOffset_ref.mscx new file mode 100644 index 0000000000000..8cacf183815c7 --- /dev/null +++ b/mtest/musicxml/io/testWedgeOffset_ref.mscx @@ -0,0 +1,1109 @@ + + + + + 0 + 480 + + 1 + 1 + 1 + 0 + + Henry Ives + + + + + + + + + Wedge Offsets + + + + stdNormal + + 3 + + Piano + + Piano + Pno. + 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 + + + + + + + + + + 12.5 + + + + Wedge Offsets + + + + + MuseScore Testcase + + + + right,top + + Henry Ives + + + + + + G + G + + + 4 + 4 + + + down + 24 + 20 + + + begin + 16th + + 67 + 15 + + + + mid + 16th + + 74 + 16 + + + + mid + 16th + + 72 + 14 + + + + mid + 16th + + 71 + 19 + + + + no + 16th + down + + 69 + 17 + + + 71 + 19 + + + 74 + 16 + + + + 16th + + + down + 23 + 24 + + + begin + 16th + + 71 + 19 + + + 72 + 14 + + + 74 + 16 + + + 76 + 18 + + + 77 + 13 + + + + mid + 16th + + 69 + 17 + + + + up + -11 + -11 + + + begin + 16th + + 64 + 18 + + + 71 + 19 + + + 74 + 16 + + + + mid + 16th + + 71 + 19 + + + + mid + 16th + + 71 + 19 + + + 72 + 14 + + + 74 + 16 + + + 76 + 18 + + + + mid + 16th + + 69 + 17 + + + 71 + 19 + + + + no + 16th + down + + 71 + 19 + + + 77 + 13 + + + + 16th + + + down + 20 + 24 + + + begin + 16th + + 71 + 19 + + + + mid + 16th + + 67 + 15 + + + 69 + 17 + + + 74 + 16 + + + 76 + 18 + + + + + + + + + 0 + + + + 1/2 + + + + + down + 23 + 23 + + + begin + 16th + + 69 + 17 + + + + mid + 16th + + 71 + 19 + + + + mid + 16th + + 71 + 19 + + + 72 + 14 + + + + mid + 16th + + 69 + 17 + + + 72 + 14 + + + + no + 16th + down + + 62 + 16 + + + 64 + 18 + + + 69 + 17 + + + 74 + 16 + + + 83 + 19 + + + + 16th + + + down + 20 + 16 + + + begin + 16th + + 71 + 19 + + + + mid + 16th + + 74 + 16 + + + + + + -1/2 + + + + + + 1 + + + + 1 + -1/2 + + + + + down + 27 + 32 + + + begin + 16th + + 69 + 17 + + + 76 + 18 + + + + mid + 16th + + 67 + 15 + + + 71 + 19 + + + 72 + 14 + + + 81 + 17 + + + + mid + 16th + + 60 + 14 + + + 74 + 16 + + + + 16th + + + down + 28 + 27 + + + begin + 16th + + 65 + 13 + + + 72 + 14 + + + 76 + 18 + + + + mid + 16th + + 72 + 14 + + + + mid + 16th + + 67 + 15 + + + 72 + 14 + + + + 16th + + + + + + + + + -1 + 1/2 + + + + + down + 24 + 24 + + + begin + 16th + + 74 + 16 + + + + mid + 16th + + 76 + 18 + + + + mid + 16th + + 67 + 15 + + + 72 + 14 + + + + mid + 16th + + 74 + 16 + + + 79 + 15 + + + + down + 19 + 19 + + + begin + 16th + + 72 + 14 + + + + mid + 16th + + 76 + 18 + + + + mid + 16th + + 81 + 17 + + + + mid + 16th + + 72 + 14 + + + + down + 20 + 19 + + + begin + 16th + + 72 + 14 + + + 74 + 16 + + + 77 + 13 + + + + mid + 16th + + 74 + 16 + + + + mid + 16th + + 74 + 16 + + + + 16th + + + down + 20 + 16 + + + begin + 16th + + 71 + 19 + + + 76 + 18 + + + + mid + 16th + + 72 + 14 + + + 76 + 18 + + + + mid + 16th + + 74 + 16 + + + 76 + 18 + + + + 16th + + + + + + + down + 19 + 23 + + + begin + 16th + + 74 + 16 + + + 79 + 15 + + + + mid + 16th + + 71 + 19 + + + 72 + 14 + + + + mid + 16th + + 72 + 14 + + + + mid + 16th + + 71 + 19 + + + 79 + 15 + + + + + 0 + + + + 1 + -1/4 + + + + + down + 19 + 20 + + + begin + 16th + + 74 + 16 + + + + mid + 16th + + 72 + 14 + + + + eighth + + + down + 23 + 23 + + + begin + 16th + + 74 + 16 + + + + mid + 16th + + 71 + 19 + + + + mid + 16th + + 69 + 17 + + + + mid + 16th + + 71 + 19 + + + 74 + 16 + + + 77 + 13 + + + + no + 16th + down + + 74 + 16 + + + + 16th + + + down + 20 + 23 + + + begin + 16th + + 74 + 16 + + + + mid + 16th + + 69 + 17 + + + 77 + 13 + + + + + + + + + + -1 + 1/4 + + + + + down + 23 + 23 + + + begin + 16th + + 71 + 19 + + + 72 + 14 + + + + mid + 16th + + 69 + 17 + + + + mid + 16th + + 71 + 19 + + + 72 + 14 + + + + 16th + + + no + 16th + down + + 69 + 17 + + + 74 + 16 + + + 77 + 13 + + + + 16th + + + down + 19 + 19 + + + begin + 16th + + 72 + 14 + + + + mid + 16th + + 72 + 14 + + + + no + 16th + down + + 69 + 17 + + + 77 + 13 + + + + 16th + + + + 1 + + + + 1 + -5/8 + + + + + no + 16th + down + + 72 + 14 + + + + 16th + + + no + 16th + down + + 72 + 14 + + + + 16th + + + eighth + + + + + + + + + -1 + 5/8 + + + + + no + 16th + down + + 76 + 18 + + + + 16th + + + eighth + + + quarter + + + half + + + end + + + + + + diff --git a/mtest/musicxml/io/tst_mxml_io.cpp b/mtest/musicxml/io/tst_mxml_io.cpp index d9d7d643f2cb8..754ee8ae2503d 100644 --- a/mtest/musicxml/io/tst_mxml_io.cpp +++ b/mtest/musicxml/io/tst_mxml_io.cpp @@ -262,6 +262,7 @@ private slots: void volta1() { mxmlIoTest("testVolta1"); } void voltaHiding1() { mxmlImportTestRef("testVoltaHiding"); } void voltaHiding2() { mxmlIoTestRef("testVoltaHiding"); } + void wedgeOffset() { mxmlImportTestRef("testWedgeOffset"); } void wedge1() { mxmlIoTest("testWedge1"); } void wedge2() { mxmlIoTest("testWedge2"); } void wedge3() { mxmlIoTest("testWedge3"); }