Skip to content
Permalink
Browse files

fix #31676 Play first note when moving multiple notes with same pitch…

… and tuning.
  • Loading branch information...
Radu-Victor Sarmasag authored and lasconic committed Mar 27, 2016
1 parent c3b51a8 commit 319c060a83d94bf7246dbbdcfdd53459820ea297
Showing with 25 additions and 0 deletions.
  1. +25 −0 mscore/musescore.cpp
@@ -3988,6 +3988,31 @@ void MuseScore::endCmd()
updateUndoRedo();
dirtyChanged(cs);
Element* e = cs->selection().element();

// For multiple notes selected check if they all have same pitch and tuning
bool samePitch = true;
int pitch = 0;
float tuning = 0;
for (int i = 0; i < cs->selection().elements().size(); ++i) {
const auto& element = cs->selection().elements()[i];
if (element->type() != Element::Type::NOTE) {
samePitch = false;
break;
}

const auto& note = static_cast<Note*>(element);
if (i == 0) {
pitch = note->ppitch();
tuning = note->tuning();
}
else if (note->ppitch() != pitch || fabs(tuning - note->tuning()) > 0.01) {
samePitch = false;
break;
}
}
if (samePitch && !cs->selection().elements().empty())
e = cs->selection().elements()[0];

if (e && (cs->playNote() || cs->playChord())) {
if (cs->playChord() && preferences.playChordOnAddNote && e->type() == Element::Type::NOTE)
play(static_cast<Note*>(e)->chord());

0 comments on commit 319c060

Please sign in to comment.
You can’t perform that action at this time.