Open wizofaus opened 2 months ago
BTW this is easily fixed by changing NotationConfiguration::setIsMidiInputEnabled
to use setLocalValue
instead of setSharedValue
.
Is there a good reason to use setSharedValue here? Personally I wouldn't expect any of the settings in this menu (auto-pan, play repeats etc.) to automatically sync between instances while they're still open. At most I'd expect that after changing such an option, the next instance I start of MuseScore will use that setting.
What I'd actually like to change it to is:
void NotationConfiguration::setIsMidiInputEnabled(bool enabled)
{
settings()->setLocalValue(IS_MIDI_INPUT_ENABLED, Val(enabled));
if (!enabled) {
midiInPort()->disconnect();
} else {
midiInPort()->connect(midiConfiguration()->midiInputDeviceId());
}
}
(requires injecting midiInPort and midiConfiguration into NotationConfiguration, but creates no additional dependencies). This allows you do disable MIDI input for one instance so another can grab exclusive access if you're not using LoopMIDI etc. However it's not really enough on its own to work smoothly, so is probably best done as part of a separate change.
I think this should be solved in the following way:
Or, @bkunda, what is your opinion about the following?
Personally I wouldn't expect any of the settings in this menu (auto-pan, play repeats etc.) to automatically sync between instances while they're still open. At most I'd expect that after changing such an option, the next instance I start of MuseScore will use that setting.
"MuseScore instances should only react to MIDI input when they have focus; just like the computer keyboard"
Yes, that would be my preference too, though on Windows that means explicitly having to release the MIDI in port on losing focus, and on gaining focus, attempting to repeated grab it until it succeeds.
But then what's the purpose of that "Enable MIDI input" menu option at all?
BTW some related issues: https://github.com/musescore/MuseScore/issues/16075 https://github.com/musescore/MuseScore/issues/23870
If it's agreed the behaviour should be "only enable MIDI input when window has the focus" and that for Windows, it should release the MIDI port when it doesn't (and try at least a couple of times when it does receive the focus, to allow time for it to be released by other processes), then I'm more than happy to implement that.
Issue type
UX/Interaction bug (incorrect behaviour)
Description with steps to reproduce
Supporting files, videos and screenshots
N/A, can record video if really needed a bit involved to demonstrate.
What is the latest version of MuseScore Studio where this issue is present?
4.4
Regression
I was unable to check
Operating system
Windows 11
Additional context
I've noted before that Windows doesn't handle MIDI input devices well with multiple processes - the fact that you need special software for it work at all is obviously not ideal, but in this case it's really MuseScore that's not doing what seems reasonable to expect, which is to maintain a separate "Enable MIDI input" state between instances - it seems to be trying to sync them all to use the same setting, though the menu itself doesn't always reflect that.
Ultimately all I want to do is to have MIDI input only work for the instance with the focus (exactly the same way computer keyboard input works), but if I'm able to at least turn it off for one instance and on for another, that's fine too.
Checklist