Skip to content

Commit e8b67cc

Browse files
committed
slur collisions
1 parent 98dda58 commit e8b67cc

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

src/engraving/dom/slur.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include "draw/types/transform.h"
2727

28+
#include "arpeggio.h"
2829
#include "beam.h"
2930
#include "chord.h"
3031
#include "measure.h"
@@ -363,6 +364,11 @@ Shape SlurSegment::getSegmentShape(Segment* seg, ChordRest* startCR, ChordRest*
363364
}
364365
const EngravingItem* item = shapeEl.item();
365366
const EngravingItem* parent = item->parentItem();
367+
// Don't remove arpeggio starting on a different voice and ending on the same voice as endCR when slur is on the outside
368+
if (item->isArpeggio() && (endCR->track() == toArpeggio(item)->endTrack()) && (!slur()->up() && toArpeggio(item)->span() > 1)) {
369+
return false;
370+
}
371+
366372
// Its own startCR or items belonging to it, lyrics, fingering, ledger lines, articulation on endCR
367373
if (item == startCR || parent == startCR || item->isTextBase() || item->isLedgerLine()
368374
|| (item->isArticulationFamily() && parent == endCR) || item->isBend() || item->isStretchedBend()) {
@@ -379,6 +385,10 @@ Shape SlurSegment::getSegmentShape(Segment* seg, ChordRest* startCR, ChordRest*
379385
|| (slur()->up() && item->track() < startCR->track()))) { // slur-up: ignore higher voices
380386
return true;
381387
}
388+
// Remove arpeggios spanning more than 1 voice starting on endCR's voice when the slur is on the inside
389+
if (item->isArpeggio() && (endCR->track() != item->track() || (!slur()->up() && toArpeggio(item)->span() > 1))) {
390+
return true;
391+
}
382392
return false;
383393
});
384394

src/engraving/rendering/dev/tlayout.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -846,15 +846,13 @@ void TLayout::layoutArpeggio(const Arpeggio* item, Arpeggio::LayoutData* ldata,
846846
} break;
847847
}
848848

849-
if (includeCrossStaffHeight && item->crossStaff()) {
850-
// Loop through staves spanned & regenerate chord shape
851-
// This makes sure the arpeggio's shape is added to the shape of each chord it spans
852-
Chord* chord = item->chord();
853-
Segment* seg = chord->segment();
854-
staff_idx_t staveSpan = (item->track() + item->span() - 1) / VOICES;
855-
for (staff_idx_t staffIdx = item->staffIdx(); staffIdx <= staveSpan; staffIdx++) {
856-
seg->createShape(staffIdx);
857-
}
849+
// Loop through staves spanned & regenerate chord shape
850+
// This makes sure the arpeggio's shape is added to the shape of each chord it spans
851+
Chord* chord = item->chord();
852+
Segment* seg = chord->segment();
853+
staff_idx_t staveSpan = (item->track() + item->span() - 1) / VOICES;
854+
for (staff_idx_t staffIdx = item->staffIdx(); staffIdx <= staveSpan; staffIdx++) {
855+
seg->createShape(staffIdx);
858856
}
859857
}
860858

vtest/scores/arpeggio-2.mscz

22.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)