Triggering commands by MIDI and KeyMappingEditorComponent


Squeezings to you all.

I needed to be able to execute commands on MIDI input for my interminable project (ALMOST OVER).

I was already using KeyMappingEditorComponent successfully, and what I want is pretty similar, except for MIDI. So I decided to refactor that code and extract most of it into a common base class which doesn’t mention “the keyboard,” and a smaller implementation class which actually does the keyboard-specific part.

Well, I did that :slight_smile: and it seems to work well - I haven’t finished the MIDI part yet but pulling the code apart went smoothly and you only need to implement three virtual methods on one class and a window class to catch your input to make your own *CommandEditor and my refactored implementation, “KeyCommandEditor” seems to work identically with JUCE’s.

You can see the code here. I split the code up into separate classes for my own edification, but I also rearranged the code ever-so-slightly - basically to get all the virtual methods onto the top class.

The class names are not of the best - I did this as fast as I could. My hope is that this will guide Jules in that direction and that I can sooner or later retire this…

I might be willing to contribute the MIDI command editing code when it’s done if would help in that direction.