Hi, I feel a little bit lost here. How do I add a Midi Controller to a Automatable Parameter. How can I use Midi learn for this?
There was a recent discussion about something similar here. Adding some sort of MIDI learn would be quite simple once you have this.
Here’s a very simple class I wrote to handle mapping various Midi Controllers to specific parameter objects:
As far as the MIDI Learn part of it, there are two possible implementations that come to mind:
- Track the last midi controller that was moved, and allow the user to click & drag (or otherwise select) that controller for mapping to any parameter [this is what @daniel does in his Plugin GUI magic, if I’m not mistaken]
- Create a “Midi learn” toggle in your GUI that, when active, immediately assigns a moved controller to the selected parameter [this is similar to how Ableton’s midi mapping works]
MidiCC_MappingManager class stores the last moved controller # and its last recieved value, which should make implementing either one of these approaches fairly straightforward.
Hope this helps!
Have you looked at the
ParameterChangeHandler class? That acts a global parameter change listener so you can find out what the last parameter to change was.
ParameterControlMappings handles a set of mappings for various AutomatableParameters (this is quite an old class though and could be better designed).
Then there’s also
Engine::getMidiLearnState which you can use to manage a global “MIDI learn” mode and use is to notify when assignments are added/removed.
I think those are all the pieces we use to implement MIDI learn with some UI on top.