Implementing a ButtonListener class for Midi messages

Hi There,

We are developing an application that will use Keyboard, Mouse and Midi input to control it. We are not using Midi to create music but as an alternative method to control the interface.

We would like to build the interface so that you can assign Midi messages to visual components. You should be able to set the GUI in a sort of midilistenmode and click a component. When the component is clicked it will get a different color and will wait for the first midi message it receives. When it receives it this component will be mapped to this message. Next time this message is received the component will respond the same as it would be clicked or change the value of a slider.

How would i set up such a thing in Juce, i was thinking of implementing a MidiListener class like the ButtonListener and make my components inherited from this. But how would i go about this.
Could anyone give me some hints on this matter.


There are thousands of approaches you could use to do that! I guess your first question is whether you put the logic in the buttons and UI controls themselves, or whether you handle the midi commands within your underlying model classes, and bypass the UI. Both ways have advantages and disadvantages…


Our GUI will not contain the logic themselves. We try to keep our engine strictly seperated from the interface as much as possible.
When midi signals come they will be processed by our underlying system and the GUI will be updated when needed.

But to be able to link Midi messages to certain functions, the Midi messages should reach the interface as well. So we will have to find a way to do this nicely.
And i thought that maybe someone had an idea how to do this the best way. I had a look at the CommandManager and maybe i can expand this to work with Midi as well.
Any other suggestions?


p.s I realized that this i posted this thread in the wrong category, sorry for this.

Yes, the command manager stuff would certainly be a good way to go for this sort of thing, because it handles things like making a button flash when its command is processed.