musescore / MuseScore

MuseScore is an open source and free music notation software. For support, contribution, bug reports, visit MuseScore.org. Fork and make pull requests!
https://musescore.org
Other
12.22k stars 2.64k forks source link

Ability to re-grab MIDI I/O port on Windows even if unavailable when process first starts #23870

Open wizofaus opened 2 months ago

wizofaus commented 2 months ago

Your idea

MuseScore should be able to accept MIDI input on Windows even if the device was unavailable when the process/application started.

Problem to be solved

Windows has a ridiculous restriction that only one process at a time can grab the MIDI I/O port. But whereas QSynth etc. allow releasing and re-acquiring it, MuseScore only seems to try on start-up and won't allow using MIDI I/O without restarting. Note that "Enable MIDI input" in the playback settings toolbar menu doesn't seem to affect this at all, nor does going into the Preferences | I/O screen.

Prior art

No response

Additional context

Ideally MuseScore would automatically try to acquire the device when it has the input focus and release it afterwards, and certainly should release it when you deselect "Enable MIDI input" from the playback settings toolbar menu. Either that or it could try to acquire it every time you enter note input mode. And hopefully show somewhere that it's not able to acquire access to the port. Especially an issue when switching between MuseScore instances.

Checklist

wizofaus commented 1 month ago

I'm happy to put my hand up to provide a fix for this because it's truly frustrating, esp. when jumping between multiple MuseScore instances. But it requires agreeing on what the desired behaviour is. I only use MIDI I/O for input, so I'd think in that case (no MIDI device selected for output), then the behaviour should be: once MuseScore loses input focus, it should automatically release the MIDI device. And when it gains it again, it should attempt to reacquire it (potentially multiple times or after a delay, whatever works reliably). But if you do have a MIDI I/O device used for output then you'd probably need an additional check that it's not currently in "play mode" on losing input focus. I'd also like to see that toggling "Enable MIDI input" releases and attempts to re-acquire MIDI port access. And it would be nice to see something in the status bar that lets you know whether the MIDI port is available. I'm actually not even sure what the point of the command is otherwise, other than to stop accidentally touching your MIDI keyboard interfering with your score...