diff --git a/libmscore/cmd.cpp b/libmscore/cmd.cpp index cd44a3a322f6..c76306c51832 100644 --- a/libmscore/cmd.cpp +++ b/libmscore/cmd.cpp @@ -378,6 +378,7 @@ Note* Score::addPitch(int pitch, bool addFlag) qDebug("add pitch %d %d", pitch, addFlag); if (addFlag) { + moveToPrevInputPos(); if (_is.cr() == 0 || _is.cr()->type() != Element::CHORD) return 0; Chord* chord = static_cast(_is.cr()); @@ -1616,6 +1617,22 @@ void Score::moveInputPos(Segment* s) } //--------------------------------------------------------- +// moveToPrevInputPos +// Derived from moveToNextInputPos() +//--------------------------------------------------------- + +void Score::moveToPrevInputPos() + { + Segment* s = _is.segment(); + Measure* m = s->measure(); + int track = _is.track(); + for (s = s->prev1(Segment::SegChordRest); s; s = s->prev1(Segment::SegChordRest)) { + if (s->element(track) || s->measure() != m) + break; + } + moveInputPos(s); + } +//--------------------------------------------------------- // moveToNextInputPos // TODO: special case: note is first note of tie: goto to last note of tie //--------------------------------------------------------- diff --git a/libmscore/score.h b/libmscore/score.h index 0480f1963b84..97d469f0d524 100644 --- a/libmscore/score.h +++ b/libmscore/score.h @@ -374,6 +374,7 @@ class Score : public QObject { void moveDown(Chord*); void moveInputPos(Segment* s); + void moveToPrevInputPos(); void moveToNextInputPos(); void padToggle(int n); diff --git a/mscore/musescore.cpp b/mscore/musescore.cpp index e06f5ac5cca4..37822a6fb599 100644 --- a/mscore/musescore.cpp +++ b/mscore/musescore.cpp @@ -1742,7 +1742,7 @@ void MuseScore::midiNoteReceived(int channel, int pitch, int velo) iter = 0; } // qDebug(" midiNoteReceived %d active %d", pitch, active); - cv->midiNoteReceived(pitch, active); + cv->midiNoteReceived(pitch, active > 0); ++active; } else {