Skip to content

Commit 076e9ce

Browse files
committed
not updating dead notes for transposition
1 parent c3842f5 commit 076e9ce

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

src/engraving/dom/note.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2139,6 +2139,16 @@ void Note::updateAccidental(AccidentalState* as)
21392139
{
21402140
int absLine = absStep(tpc(), epitch());
21412141

2142+
if (deadNote()) {
2143+
if (m_accidental) {
2144+
score()->undoRemoveElement(m_accidental);
2145+
}
2146+
2147+
as->setForceRestateAccidental(absLine, false);
2148+
updateRelLine(absLine, true);
2149+
return;
2150+
}
2151+
21422152
// Ensure m_centOffset and microtonal accidental match (they can mismatch when switching from TAB)
21432153
if (muse::RealIsNull(m_centOffset)) {
21442154
if (m_accidental && !muse::RealIsNull(Accidental::subtype2centOffset(m_accidental->accidentalType()))) {
@@ -4104,6 +4114,10 @@ int Note::stringOrLine() const
41044114

41054115
bool Note::transposeDiatonic(int interval, bool keepAlterations, bool useDoubleAccidentals)
41064116
{
4117+
if (deadNote()) {
4118+
return true;
4119+
}
4120+
41074121
// compute note current absolute step
41084122
int alter;
41094123
Fraction tick = chord()->segment()->tick();
@@ -4148,6 +4162,10 @@ bool Note::transposeDiatonic(int interval, bool keepAlterations, bool useDoubleA
41484162

41494163
bool Note::transpose(Interval interval, bool useDoubleSharpsFlats)
41504164
{
4165+
if (deadNote()) {
4166+
return true;
4167+
}
4168+
41514169
int npitch = pitch() + interval.chromatic;
41524170
if (!pitchIsValid(npitch)) {
41534171
return false;

src/engraving/dom/stringdata.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,9 @@ void StringData::fretChords(Chord* chord) const
246246
nString = nNewString = note->string();
247247
nFret = nNewFret = note->fret();
248248
note->setFretConflict(false); // assume no conflicts on this note
249+
if (note->deadNote()) {
250+
continue;
251+
}
249252
// if no fretting (any invalid fretting has been erased by sortChordNotes() )
250253
if (nString == INVALID_STRING_INDEX /*|| nFret == INVALID_FRET_INDEX || getPitch(nString, nFret) != note->pitch()*/) {
251254
const CapoParams& capo = note->staff()->capo(note->tick());
@@ -518,6 +521,9 @@ void StringData::sortChordNotesUseSameString(const Chord* chord, int pitchOffset
518521
if (note->displayFret() != Note::DisplayFretOption::NoHarmonic) {
519522
continue;
520523
}
524+
if (note->deadNote()) {
525+
continue;
526+
}
521527
if (note->string() < 0 || note->fret() < 0) {
522528
anyReset = true;
523529
continue;
@@ -538,6 +544,9 @@ void StringData::sortChordNotesUseSameString(const Chord* chord, int pitchOffset
538544
if (note->displayFret() != Note::DisplayFretOption::NoHarmonic) {
539545
continue;
540546
}
547+
if (note->deadNote()) {
548+
continue;
549+
}
541550
note->setString(INVALID_STRING_INDEX);
542551
note->setFret(INVALID_FRET_INDEX);
543552
}
@@ -576,8 +585,8 @@ void StringData::sortChordNotes(std::map<int, Note*>& sortedNotes, const Chord*
576585
int pitch = getPitch(string, noteFret, pitchOffsetAt(chord->staff(), chord->tick(), string));
577586
// if note not fretted yet or current fretting no longer valid,
578587
// use most convenient string as key
579-
if (!note->negativeFretUsed() && (string <= INVALID_STRING_INDEX || noteFret <= INVALID_FRET_INDEX
580-
|| (pitchIsValid(pitch) && pitch != note->pitch()))) {
588+
if (!note->deadNote() && !note->negativeFretUsed() && (string <= INVALID_STRING_INDEX || noteFret <= INVALID_FRET_INDEX
589+
|| (pitchIsValid(pitch) && pitch != note->pitch()))) {
581590
note->setString(INVALID_STRING_INDEX);
582591
note->setFret(INVALID_FRET_INDEX);
583592
}

src/engraving/editing/transpose.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,10 @@ Interval Transpose::keydiff2Interval(Key oKey, Key nKey, TransposeDirection dir)
538538
bool Transpose::transposeNote(Note* note, TransposeMode mode, int transposeInterval, bool trKeys, bool useDoubleSharpsFlats,
539539
Interval interval)
540540
{
541+
if (note->deadNote()) {
542+
return true;
543+
}
544+
541545
if (mode == TransposeMode::DIATONICALLY) {
542546
return note->transposeDiatonic(transposeInterval, trKeys, useDoubleSharpsFlats);
543547
}

0 commit comments

Comments
 (0)