Skip to content

Add MIDI GUI tab and learn function#3502

Merged
ann0see merged 1 commit intojamulussoftware:mainfrom
ignotus666:midi-gui-learn
Mar 13, 2026
Merged

Add MIDI GUI tab and learn function#3502
ann0see merged 1 commit intojamulussoftware:mainfrom
ignotus666:midi-gui-learn

Conversation

@ignotus666
Copy link
Copy Markdown
Member

@ignotus666 ignotus666 commented May 22, 2025

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 --ctrlmidich command 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 --ctrlmidich parameter 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.

MIDI_GUI

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

  • I've verified that this Pull Request follows the general code principles
  • I tested my code and it does what I want
  • My code follows the style guide
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I've filled all the content above

@softins softins added this to the Release 4.0.0 milestone May 22, 2025
@ignotus666 ignotus666 marked this pull request as draft May 22, 2025 14:07
@softins
Copy link
Copy Markdown
Member

softins commented May 28, 2025

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.

@ignotus666
Copy link
Copy Markdown
Member Author

@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.

@ann0see
Copy link
Copy Markdown
Member

ann0see commented May 31, 2025

Nice!

I'd like to open a discussion:

  1. Do you think a separate MIDI tab is useful or does it add clutter?
  2. Is there a better word instead of "Learn" for the detector? How can we make the feature clear to the user? Would a dynamic text field showing currently pressed buttons be better? (I'm unsure as this could be more complicated)

@ignotus666
Copy link
Copy Markdown
Member Author

@ann0see

  1. Given the number of MIDI settings, I don't see how it would fit in somewhere else without cluttering up that section in a worse way. I think it merits its own tab.
  2. "Learn" is a standard term for this feature. I see and use it in many other MIDI applications. Maybe "MIDI learn"? But I think that might make the button too large.

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.

@ignotus666
Copy link
Copy Markdown
Member Author

ignotus666 commented Jun 2, 2025

Tested on Linux, Windows (no JACK) and macOS (legacy and non-legacy), and it seems to be working on these three platforms at least.

Comment thread src/clientsettingsdlg.cpp Outdated
@ignotus666 ignotus666 added the needs documentation PRs requiring documentation changes or additions label Jul 1, 2025
@pljones pljones added this to Tracking Jan 25, 2026
@github-project-automation github-project-automation Bot moved this to Triage in Tracking Jan 25, 2026
@pljones
Copy link
Copy Markdown
Collaborator

pljones commented Jan 25, 2026

OK just stumbled onto this. As this is a new feature, the following need to be adhered to:

  • All updates in the UI should only work by emitting a signal to the main application, where state is held -- no state to be held in the UI (I've not reviewed the code yet)
  • Any UI enhancement should be mirrored by an enhancement to the JSONRPC API, if the feature is missing there

(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.)

Copy link
Copy Markdown
Collaborator

@pljones pljones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get rid of all the unnecessary changes in spacing and resubmit the PR. As it stands, I can't review it.

@github-project-automation github-project-automation Bot moved this from Triage to Waiting externally in Tracking Jan 25, 2026
@ignotus666
Copy link
Copy Markdown
Member Author

ignotus666 commented Jan 25, 2026

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.

All updates in the UI should only work by emitting a signal to the main application, where state is held -- no state to be held in the UI (I've not reviewed the code yet)

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.

@ann0see
Copy link
Copy Markdown
Member

ann0see commented Jan 25, 2026

I believe this should be rebased and squashed into one commit.

@pljones
Copy link
Copy Markdown
Collaborator

pljones commented Jan 26, 2026

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.

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 soundbase.cpp (as a static), just to remove a bit of clutter.

@ignotus666 ignotus666 force-pushed the midi-gui-learn branch 2 times, most recently from fe82247 to 7097b29 Compare January 27, 2026 08:21
@ignotus666
Copy link
Copy Markdown
Member Author

as @ann0see says, please rebase and squash.

Done.

One thing I might ask is for the command line parsing code to be moved into soundbase.cpp (as a static), just to remove a bit of clutter.

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.

@ann0see
Copy link
Copy Markdown
Member

ann0see commented Jan 27, 2026

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

@ignotus666
Copy link
Copy Markdown
Member Author

  • Any UI enhancement should be mirrored by an enhancement to the JSONRPC API, if the feature is missing there

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.

@ignotus666
Copy link
Copy Markdown
Member Author

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

The problem is that in the TODO blocks, the TODO lines don't have a space after //, but all other comments do. I couldn't find a way to preserve that distinction other than by adding CommentPragmas: '^ TODO:|^### TODO:' to clang-format. It works (I'll use it myself for now), but maybe there's a better way.

@ignotus666 ignotus666 force-pushed the midi-gui-learn branch 2 times, most recently from 26f4096 to 1f2f394 Compare January 29, 2026 16:02
Comment thread src/sound/asio/sound.h
Comment thread src/clientdlg.cpp
Comment thread src/clientsettingsdlg.cpp Outdated
Comment thread src/clientsettingsdlg.cpp
Comment thread src/clientsettingsdlg.cpp Outdated
@softins
Copy link
Copy Markdown
Member

softins commented Mar 3, 2026

On an unrelated note, could you rebase this PR to the current upstream main? Thanks!

Comment thread src/client.cpp Outdated
@softins
Copy link
Copy Markdown
Member

softins commented Mar 3, 2026

Apart from that one change needed, all looking good. I've only tested on Windows so far.

@ignotus666
Copy link
Copy Markdown
Member Author

ignotus666 commented Mar 3, 2026

@softins Done. It needed to be changed to -1 in settings.h too. Did you test pick-up mode? I'm curious as to how that is working with a commercial controller - I only have a DIY one I made myself to test with.

@softins
Copy link
Copy Markdown
Member

softins commented Mar 3, 2026

It needed to be changed to -1 in settings.h too.

No it didn't. iMidiMuteMyself is already qualified by bMidiMuteMyselfEnabled. It is only the value passed in to SetMIDIControllerMapping() that needs to be -1 when mute myself is not enabled.

Did you test pick-up mode? I'm curious as to how that is working with a commercial controller - I only have a DIY one I made myself to test with.

No, I haven't tried that yet. I was wondering earlier what it was, then I found the "What's this" for it :)

@ignotus666
Copy link
Copy Markdown
Member Author

No it didn't. iMidiMuteMyself is already qualified by bMidiMuteMyselfEnabled. It is only the value passed in to SetMIDIControllerMapping() that needs to be -1 when mute myself is not enabled.

Oops - you're right. Undid that change.

@softins
Copy link
Copy Markdown
Member

softins commented Mar 3, 2026

Did you test pick-up mode? I'm curious as to how that is working with a commercial controller - I only have a DIY one I made myself to test with.

No, I haven't tried that yet. I was wondering earlier what it was, then I found the "What's this" for it :)

I've tried it now, and it seems to work fine.

@softins
Copy link
Copy Markdown
Member

softins commented Mar 3, 2026

I've also compiled and tested it successfully on macOS. Although the checkboxes appear to be smaller than normal.

@softins
Copy link
Copy Markdown
Member

softins commented Mar 4, 2026

I've just read through the historical conversation now. Thanks to @pljones and @ignotus666 for working together on this; I ignored it till very recently, as I was busy with other items.

I'm ready in principle to approve this. I've tested it on Windows and macOS, but not on Linux, but I'm happy that the main development was done on Linux anyway.

I'm conscious that I haven't tried the JSONRPC extensions that support this. @ignotus666, how have you tested them, and do you have any scripts or test harness?

@ignotus666
Copy link
Copy Markdown
Member Author

@softins I'm using a test script that Claude kindly made for me. Put it in /tools and run bash tools/test_midi_rpc.sh from the root directory:

test_midi_rpc.sh

@softins
Copy link
Copy Markdown
Member

softins commented Mar 5, 2026

@softins I'm using a test script that Claude kindly made for me. Put it in /tools and run bash tools/test_midi_rpc.sh from the root directory:

Great, thanks! That all seems to work nicely.

@ann0see ann0see requested a review from pljones March 7, 2026 22:52
@github-project-automation github-project-automation Bot moved this from Waiting externally to Waiting on Team in Tracking Mar 13, 2026
@ann0see ann0see merged commit 8d1cf47 into jamulussoftware:main Mar 13, 2026
16 checks passed
@github-project-automation github-project-automation Bot moved this from Waiting on Team to Done in Tracking Mar 13, 2026
@ann0see
Copy link
Copy Markdown
Member

ann0see commented Mar 13, 2026

Thank you very much!

pljones added a commit to pljones/jamulus that referenced this pull request Mar 15, 2026
pljones added a commit to pljones/jamulus that referenced this pull request Mar 15, 2026
pljones added a commit to pljones/jamulus that referenced this pull request Mar 23, 2026
@pljones pljones mentioned this pull request Apr 1, 2026
65 tasks
@ann0see
Copy link
Copy Markdown
Member

ann0see commented Apr 7, 2026

@ignotus666 I assume this is fully documented on the website?

@ignotus666
Copy link
Copy Markdown
Member Author

@ann0see yes, I think it's all been covered.

@ignotus666 ignotus666 deleted the midi-gui-learn branch April 13, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs documentation PRs requiring documentation changes or additions

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants