Skip to content

Commit

Permalink
ENG-78: fix wedges with <offset> values
Browse files Browse the repository at this point in the history
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
  • Loading branch information
iveshenry18 authored and Jojo-Schmitz committed Sep 26, 2021
1 parent 1725503 commit e253f86
Show file tree
Hide file tree
Showing 4 changed files with 2,666 additions and 6 deletions.
12 changes: 6 additions & 6 deletions importexport/musicxml/importmxmlpass2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3091,20 +3091,20 @@ 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);
delete desc._sp;
}
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;
}
Expand All @@ -3113,7 +3113,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);
Expand All @@ -3124,13 +3124,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;
}
}
Expand Down
Loading

0 comments on commit e253f86

Please sign in to comment.