Add MIDI GUI tab and learn function#3502
Add MIDI GUI tab and learn function#3502ignotus666 wants to merge 5 commits intojamulussoftware:mainfrom
Conversation
|
Thanks for this contribution. It looks like a useful feature. I will be happy to test it in due course, on Linux, Windows and Mac, but at the moment most of my kit is packed away for a pending house move. |
|
@softins thanks - no worries, I guess there will be plenty of time for testing before this ever makes it in (if it does). Hope the house move goes smoothly. |
|
Nice! I'd like to open a discussion:
|
In any event, this is still under development as I'm finding that some of my implementations are far from perfect. E.g. the way the MIDI in port is currently kept open I think has been done wrong, so I'm working on that. I'm testing a version where the MIDI port can be enabled/disabled at runtime, as among other things it affects whether numbers are prepended to user names in the mixer board - if you're not using MIDI you won't want that. The main purpose for opening this PR was to generate builds for other platforms for testing, but for now it's just a PoC that's far from finished, so any suggestions are welcome. |
|
Tested on Linux, Windows (no JACK) and macOS (legacy and non-legacy), and it seems to be working on these three platforms at least. |
|
OK just stumbled onto this. As this is a new feature, the following need to be adhered to:
(The "learn" feature for JSONRPC would just be the eventual "set X to Y" update, the visual behaviour would be for the JSONRPC user to supply - it just needs to be able to send the same update to the core code as the Client UI.) |
pljones
left a comment
There was a problem hiding this comment.
Get rid of all the unnecessary changes in spacing and resubmit the PR. As it stands, I can't review it.
Done. Those keep getting added in by clang.
It's been almost a year since I did this, but as far as I recall it updates the main application state via pSettings and pClient. |
|
I believe this should be rebased and squashed into one commit. |
It looks pretty good -- as @ann0see says, please rebase and squash. Then check the resultant diff for anything obvious 😄 - it looks mostly okay to me but there's a few places I'm not sure what was being intended, so I might have some more questions. One thing I might ask is for the command line parsing code to be moved into |
fe82247 to
7097b29
Compare
Done.
Done. I don't know what clang is whining about - I can't use it because it reformats a ton of stuff that shouldn't be. |
Known issue. We should really bump the clang format version. Otherwise be sure to use the same clang format version as used in the CI |
I've been working on this - should the UI immediately reflect changes from JSONRPC commands sent? It doesn't seem to do this for the existing commands but just to confirm. |
The problem is that in the TODO blocks, the TODO lines don't have a space after |
26f4096 to
1f2f394
Compare
|
@pljones I had a go at addressing most of your comments - the biggest change being moving the MIDI command line parsing to |
|
Can the client know whether it will be possible to enable a MIDI port before trying? Should it try if Should the tab be visible without a MIDI port? If that tab is there, should the checkbox be enabled? |
So I suppose in either case (launched via command line or launcher) it should check if it can create a port, and if not, disable the checkbox (and thus the MIDI settings), and issue a warning? I'm not sure it's practical or necessary to hide the tab altogether though. |
|
Either hide it or add gray it out. I'd prefer to fully hide it if it's unavailable. |
But in this scenario if a MIDI port can't be created it's an OS problem, isn't it? It could be any number of things (permissions, missing libraries...), so how could Jamulus diagnose it and say what the solution is?
If a user intends to use MIDI but launches Jamulus and finds the MIDI tab isn't even there, won't that lead to more confusion? At least if the tab's there (but the content is greyed out) and displays an error message when they try to enable the port they know they need to check their OS configuration. BTW, there are already error messages output to the command line if a MIDI port can't be opened. I can add a check, and if the port can't be opened, it will uncheck the MIDI-in (if enabled) checkbox, grey out the settings, and display an error message. The thing is, depending on the OS, the probable cause is likely different. macOS/Linux allow multiple clients to connect to the same MIDI device, but Windows only grants exclusive access. A solution would be to make the error messages platform-specific in order to give the user the best chance to identify the problem. |
|
Yes, I agree. Once the MIDI Tab exists, it should always appear. If it's not available because Jamulus cannot detect a MIDI port, the check box to enable the feature should be disabled with a message that makes it clear that all Jamulus knows is that it can't detect a MIDI port. Are the existing errors issued by Jamulus (i.e. as part of trying to open the port)? If so, that's probably all that needs to be logged. For the UI, just indicate there's a problem opening the port, uncheck and disable the checkbox. |
Yes, that was already there.
Done. If the port can't be created, the checkbox is disabled, the MIDI settings are greyed out, and an error message is displayed in the UI. |
src/sound/asio/sound.cpp
Outdated
| { | ||
| Midi.MidiStart(); | ||
| bMidiEnabled = true; | ||
| bMidiEnabled = Midi.IsActive(); // Only set to true if MIDI actually started |
There was a problem hiding this comment.
Maybe put this after the if / else and get rid of the other assign?
| pSettings->bUseMIDIController = false; | ||
| chbUseMIDIController->setChecked ( false ); | ||
| SetMIDIControlsEnabled ( false ); | ||
| QMessageBox::warning ( this, tr ( "Could not open MIDI port" ), tr ( "Please check your OS configuration." ) ); |
There was a problem hiding this comment.
Can the JSONRPC code return an error indication in this situation?
| QObject::connect ( chbUseMIDIController, &QCheckBox::toggled, this, [this] ( bool checked ) { | ||
| pSettings->bUseMIDIController = checked; | ||
| SetMIDIControlsEnabled ( checked ); | ||
| pClient->SetSettings ( pSettings ); |
src/clientsettingsdlg.cpp
Outdated
| QMessageBox::warning ( this, tr ( "Could not open MIDI port" ), tr ( "Please check your OS configuration." ) ); | ||
| } | ||
|
|
||
| emit MIDIControllerUsageChanged ( pSettings->bUseMIDIController ); |
There was a problem hiding this comment.
Only do this if it changed successfully?
|
#3502 (review)
so you should be okay to go with it. |
The issue apparently is with std::unordered_map, which isn't Qt native, so certain Qt versions will have compilation issues. I've used what is claimed to be a Qt-native approach. See what you think. |
Adds a MIDI tab to the Settings menu and exposes the MIDI parameters so they can be changed via the GUI. MIDI CC numbers can be automatically set using "learn" buttons that when pressed, listen for an incoming MIDI message and store it. Starting Jamulus with
--ctrlmidichcommand line arguments overrides and replaces those set via the GUI.The MIDI-in port can be enabled/disabled at runtime instead of it being determined at launch by the
--ctrlmidichparameter or by making it permanently open. This means that user names are prepended by a number depending on whether the MIDI in port has been enabled or not (as is the case now).I've also ditched the "Offset" term, at least for the GUI. It's a hangover from the days when that's what it was, a value hard-coded for a specific Behringer device, but in the current context it no longer makes sense.
EDIT: Added JSONRPC support.
CHANGELOG: Client: Added MIDI tab to Settings GUI exposing MIDI parameters. MIDI Learn feature also added.
Context: Fixes an issue?
Does this change need documentation? What needs to be documented and how?
Needs to be documented.
Status of this Pull Request
Working on Linux, Windows and macOS but should be tested more thoroughly.
What is missing until this pull request can be merged?
Further testing and code review.
Checklist