UIConnection and Parameter Watcher style binding for Macros

  • I'm building my UI and modules using the raw C++ approach. The UIConnection::Slider class and Parameter watchers have been helpful for binding my custom controls to the various Processor parameters.

    Now, I want to use Macros with my custom sliders to control multiple parameters at once. I've been looking over the code a bit, and I'm not clear on the best way to proceed. I only want to show the custom macro control Not the parameters it controls.

    There's no implementation of a UIConnection for a Macro, such that changing the slider updates the macro value, and when the macro changes, not from the UI, my slider gets updated.

    I've also used the Parameter Watcher to bind to a parameter in that one way direction to the UI, and that would also be needed for my implementation.

    Setting the macro value when moving the slider is simple. But getting updates from the macro when it changes is the challenge.

    Any thoughts? I can write a custom UIConnection class, but I don't know how to solve updating the UI only when my slider didn't initiate the change.

  • UPDATE: I added a new method to MacroConnectionListener virtual void macroLoadedFromValueTree(int macroIndex, float value){} which I call when a new value tree is loaded for the macros. My custom component calls setMacroControl on the sliderValueChanged callback, and updates the slider value on the macroLoadedFromValueTree callback.

    To watch the parameter, I search for the first parameter for that macro index and set up a parameter watcher, converting the NormalisableRange to a linear 0 to 1 value in the callback.

    Since parameters can change with every preset, I set that parameter watcher up at the same time macroLoadedFromValueTree is called making sure to dispatch to the MessageManager for any repaints.

    It's not as convenient as a UIConnection class, but it works.

Log in to reply