HISE Logo Forum
    • Categories
    • Register
    • Login

    UIConnection and Parameter Watcher style binding for Macros

    Scheduled Pinned Locked Moved C++ Development
    2 Posts 1 Posters 262 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • O
      ohtravioso
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • O
        ohtravioso
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post

        24

        Online

        1.7k

        Users

        11.8k

        Topics

        102.8k

        Posts