How to update GUI components (sliders) from midi CC messages


#1

Hi,

Forgive me, but I'm a real newb with JUCE... I'm conducting some research to make a plugin that can both listen for specific MIDI CCs coming in on specific channels and update it's UI (sliders/knobs) accordingly. It also needs to listen for changes to it's UI (sliders/knobs) and echo out the same MIDI CCs (presumably on those same channels).

I've followed the tutorials and can manipulate the midi buffer but cannot figure out how to "listen" for MIDI CC events. Or, more specificially, I can recognize it within the AudioProcessor, but can't call back to the AudioProcessorEditor and call a specific function.

For example to start, I'd like to listen for the volume MIDI CC and have it update a slider.

What's the best what to do that?


#2

I think you could use a Timer in the editor to update the Components. So in the timerCallback(), set the value of the Component to some value in the processor. Of course don't send a change notification. 

Here's some code from the timerCallback() in the audio plugin demo that I believe does this same thing. 

gainSlider.setValue (ourProcessor.gain->getValue(), dontSendNotification);
delaySlider.setValue (ourProcessor.delay->getValue(), dontSendNotification);

#3

This come up for me too, Is there a way to do so other than using timer? It would be great to access editor’s objects from processor.