Midi does not sound when in note-entry mode

• Feb 9, 2013 - 22:53
Type
Functional
Severity
S4 - Minor
Status
closed
Project

In note-entry mode, when entering notes by MIDI, the notes are not played. When note-entry mode is exited after playing one or more MIDI notes, the last selected note is played at that time.

The playing of the note is requested in Score::setNoteRest() by the statement _playNote = true;. This flag is tested in MuseScore::endCmd() and the selected note played.

However, on MIDI input, there is currently no call to MuseScore::endCmd() to do this. Examination of the code shows that this function is called from various other places after certain operations, and particularly from MuseScore::cmd(). But MIDI input is handled in Score::processMidiInput() called from ScoreView::cmd(const QAction* a).

Examination of Score::processMidiInput() reveals that it returns true if MIDI input was processed and false if not.

So at the end of ScoreView::cmd(const QAction* a) in scoreview.cpp at about line 2800, I would like to change the bare:

      _score->processMidiInput();

into:

      if (_score->processMidiInput())
            mscore->endCmd();

This appears to fix the problem for me (notes are now played when entered), but as this is deep into code I am fairly new to, I wanted to check if there is any reason this should not be done.

Thanks!


Comments

I also discovered that without this change, the input cursor (shaded box) didn't move as notes were input. After applying thie change, the cursor moved along correctly while entering notes.

After some detailed analysis and stepping through, I couldn't find any reason MuseScore::endCmd() shouldn't be called at this point.