Skip to content

Commit

Permalink
Allow unison cue notes with filled noteheads to overlap
Browse files Browse the repository at this point in the history
  • Loading branch information
miiizen committed May 21, 2024
1 parent 9f8076b commit 37c1cb5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/engraving/rendering/dev/chordlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1716,10 +1716,11 @@ void ChordLayout::layoutChords1(LayoutContext& ctx, Segment* segment, staff_idx_
// the most important rules for sharing noteheads on unisons between voices are
// that notes must be one same line with same tpc
// noteheads must be unmirrored and of same group
// and chords must be same size (or else sharing code won't work)
// and chords must be same size if notehead is anything other than HEAD_QUARTER
if (n->headGroup() != p->headGroup() || n->tpc() != p->tpc() || n->ldata()->mirror()
|| p->ldata()->mirror()
|| nchord->isSmall() != pchord->isSmall()) {
|| (nchord->isSmall() != pchord->isSmall()
&& (nHeadType != NoteHeadType::HEAD_QUARTER || pHeadType != NoteHeadType::HEAD_QUARTER))) {
shareHeads = false;
} else {
// noteheads are potentially shareable
Expand Down Expand Up @@ -1798,10 +1799,17 @@ void ChordLayout::layoutChords1(LayoutContext& ctx, Segment* segment, staff_idx_
Note* previousNote = overlapNotes[i - 1];
Note* n = overlapNotes[i];
if (!(previousNote->chord()->isNudged() || n->chord()->isNudged())) {
const bool prevChordSmall = previousNote->chord()->isSmall();
const bool nChordSmall = n->chord()->isSmall();
if (previousNote->chord()->dots() == n->chord()->dots()) {
// hide one set dots
// hide one set of dots
// Hide the small augmentation dot if present
bool onLine = !(previousNote->line() & 1);
if (onLine) {
if (prevChordSmall) {
previousNote->setDotsHidden(true);
} else if (nChordSmall) {
n->setDotsHidden(true);
} else if (onLine) {
// hide dots for lower voice
if (previousNote->voice() & 1) {
previousNote->setDotsHidden(true);
Expand All @@ -1817,6 +1825,16 @@ void ChordLayout::layoutChords1(LayoutContext& ctx, Segment* segment, staff_idx_
}
}
}
// If either chord is small, adjust offset
Chord* smallChord = prevChordSmall ? previousNote->chord() : nullptr;
smallChord = nChordSmall ? n->chord() : smallChord;
if (smallChord && !(prevChordSmall && nChordSmall)) {
if (smallChord->up()) {
centerUp *= 2;
} else {
centerDown = 0;
}
}
// formerly we hid noteheads in an effort to fix playback
// but this doesn't work for cases where noteheads cannot be shared
// so better to solve the problem elsewhere
Expand Down
Binary file added vtest/scores/chord-small.mscz
Binary file not shown.

0 comments on commit 37c1cb5

Please sign in to comment.