Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failed assertion on tstamp slur #3833

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/calcslurdirectionfunctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ FunctorCode CalcSlurDirectionFunctor::VisitSlur(Slur *slur)
if (slur->HasBulge()) {
LogWarning("Mixed curve direction is ignored for slurs with prescribed bulge.");
}
else if (start->Is(TIMESTAMP_ATTR) || end->Is(TIMESTAMP_ATTR)) {
LogWarning("Mixed curve direction is ignored for slurs with tstamp boundary.");
}
else {
const int startStaffN = start->GetAncestorStaff(RESOLVE_CROSS_STAFF)->GetN();
const int endStaffN = end->GetAncestorStaff(RESOLVE_CROSS_STAFF)->GetN();
Expand Down
12 changes: 8 additions & 4 deletions src/slur.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,15 +527,17 @@ const Staff *Slur::CalculateExtremalStaff(const Staff *staff, int xMin, int xMax
bool Slur::IsElementBelow(const LayerElement *element, const Staff *startStaff, const Staff *endStaff) const
{
assert(element);
assert(startStaff);
assert(endStaff);
// startStaff and endStaff may be NULL (if the boundary is a tstamp)
// however, slurs with tstamp should never have S-shape

switch (this->GetDrawingCurveDir()) {
case SlurCurveDirection::Above: return true;
case SlurCurveDirection::Below: return false;
case SlurCurveDirection::AboveBelow:
assert(startStaff);
return (element->GetAncestorStaff(RESOLVE_CROSS_STAFF)->GetN() == startStaff->GetN());
case SlurCurveDirection::BelowAbove:
assert(endStaff);
return (element->GetAncestorStaff(RESOLVE_CROSS_STAFF)->GetN() == endStaff->GetN());
default: return false;
}
Expand All @@ -544,15 +546,17 @@ bool Slur::IsElementBelow(const LayerElement *element, const Staff *startStaff,
bool Slur::IsElementBelow(const FloatingPositioner *positioner, const Staff *startStaff, const Staff *endStaff) const
{
assert(positioner);
assert(startStaff);
assert(endStaff);
// startStaff and endStaff may be NULL (if the boundary is a tstamp)
// however, slurs with tstamp should never have S-shape

switch (this->GetDrawingCurveDir()) {
case SlurCurveDirection::Above: return true;
case SlurCurveDirection::Below: return false;
case SlurCurveDirection::AboveBelow:
assert(startStaff);
return (positioner->GetAlignment()->GetStaff()->GetN() == startStaff->GetN());
case SlurCurveDirection::BelowAbove:
assert(endStaff);
return (positioner->GetAlignment()->GetStaff()->GetN() == endStaff->GetN());
default: return false;
}
Expand Down
Loading