Midi does not sound when in note-entry mode
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.https://github.com/musescore/MuseScore/pull/212
Fixed in 4e07d792a8
Hi Tony, good news!
Would you like to give a look at #19649: No playback during "note entry mode" when entering notes via MIDI keyboard and close that too if your changes fix it?
Yes, I wasn't aware of that earlier bug report when I filed this one. I've marked the other one as a duplicate.... and now as fixed.
Automatically closed -- issue fixed for 2 weeks with no activity.