Skip to content

Commit

Permalink
Correct off-by-one error in SpannerFilter::isPlayable
Browse files Browse the repository at this point in the history
This immediately fixes musescore#16757, which occurred when a chord right
after the end of a pedal line was counted as intersecting its
duration.

This commit also reverts the subtraction by `Constants::DIVISION / 4`
for the duration of a pedal line ending in an angled hook. This
subtraction was introduced in order to fix musescore#12869, but it has caused
other issues such as musescore#16001 and is probably unneeded given the
fix to `isPlayable`.
  • Loading branch information
bluebear94 committed Jul 24, 2023
1 parent 8cd265f commit 0b15e03
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/engraving/playback/filters/spannerfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ bool SpannerFilter::isPlayable(const EngravingItem* item, const RenderingContext
int spannerTo = spannerFrom + spannerDurationTicks;

if (spannerDurationTicks == 0
|| spannerTo < ctx.nominalPositionStartTick
|| spannerTo <= ctx.nominalPositionStartTick
|| spannerFrom >= ctx.nominalPositionEndTick) {
return false;
}
Expand All @@ -56,13 +56,6 @@ int SpannerFilter::spannerActualDurationTicks(const Spanner* spanner, const int
return spanner->endSegment()->tick().ticks() - spanner->tick().ticks() - 1;
}

if (spanner->type() == ElementType::PEDAL) {
const Pedal* pedal = toPedal(spanner);
if (pedal->endHookType() == HookType::HOOK_45) {
return nominalDurationTicks - Constants::DIVISION / 4;
}
}

if (spanner->type() == ElementType::SLUR) {
EngravingItem* startItem = spanner->startElement();
EngravingItem* endItem = spanner->endElement();
Expand Down

0 comments on commit 0b15e03

Please sign in to comment.