Skip to content

Commit 842fa74

Browse files
iveshenry18Jojo-Schmitz
authored andcommitted
ENG-78: fix wedges with <offset> values
Previously, the <offset> element was not correctly applied to any spanners in <direction> elements. This commit fixes that and adjusts the applicable tests accordingly. Duplicate of musescore#8766, part 3
1 parent 07a7c40 commit 842fa74

File tree

4 files changed

+2666
-6
lines changed

4 files changed

+2666
-6
lines changed

importexport/musicxml/importmxmlpass2.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3091,20 +3091,20 @@ void MusicXMLParserDirection::direction(const QString& partId,
30913091
}
30923092

30933093
// handle the spanner stops first
3094-
foreach (auto desc, stops) {
3094+
for (auto desc : stops) {
30953095
auto& spdesc = _pass2.getSpanner({ desc._tp, desc._nr });
30963096
if (spdesc._isStopped) {
30973097
_logger->logError("spanner already stopped", &_e);
30983098
delete desc._sp;
30993099
}
31003100
else {
31013101
if (spdesc._isStarted) {
3102-
handleSpannerStop(spdesc._sp, track, tick, spanners);
3102+
handleSpannerStop(spdesc._sp, track, tick + _offset, spanners);
31033103
_pass2.clearSpanner(desc);
31043104
}
31053105
else {
31063106
spdesc._sp = desc._sp;
3107-
spdesc._tick2 = tick;
3107+
spdesc._tick2 = tick + _offset;
31083108
spdesc._track2 = track;
31093109
spdesc._isStopped = true;
31103110
}
@@ -3113,7 +3113,7 @@ void MusicXMLParserDirection::direction(const QString& partId,
31133113

31143114
// then handle the spanner starts
31153115
// TBD handle offset ?
3116-
foreach (auto desc, starts) {
3116+
for (auto desc : starts) {
31173117
auto& spdesc = _pass2.getSpanner({ desc._tp, desc._nr });
31183118
if (spdesc._isStarted) {
31193119
_logger->logError("spanner already started", &_e);
@@ -3124,13 +3124,13 @@ void MusicXMLParserDirection::direction(const QString& partId,
31243124
_pass2.addSpanner(desc);
31253125
// handleSpannerStart and handleSpannerStop must be called in order
31263126
// due to allocation of elements in the map
3127-
handleSpannerStart(desc._sp, track, placement(), tick, spanners);
3127+
handleSpannerStart(desc._sp, track, placement(), tick + _offset, spanners);
31283128
handleSpannerStop(spdesc._sp, spdesc._track2, spdesc._tick2, spanners);
31293129
_pass2.clearSpanner(desc);
31303130
}
31313131
else {
31323132
_pass2.addSpanner(desc);
3133-
handleSpannerStart(desc._sp, track, placement(), tick, spanners);
3133+
handleSpannerStart(desc._sp, track, placement(), tick + _offset, spanners);
31343134
spdesc._isStarted = true;
31353135
}
31363136
}

0 commit comments

Comments
 (0)