Equivalent to Reaper UI button?
-
Reaper has a button that can change any plugin GUI into a simple slider based interface.
Is there an easy way to recreate this in HISE? I have a bunch of panels that contain components and it looks like it's not possible to dynamically change parentComponent and place all controls in a single panel.
-
@Dan-Korneff You'd need to have a separate GUI in a hidden panel that mirrors your real GUI. Then you show the panel when the button is pressed. This might cause issues though if people choose to display the generic UI in Reaper (and there are other hosts that offer this feature).
-
David is right.
If you're creating controls using a helper function, simply create another one. You can then be increasing a counter which you can use to automatically set up the sliders in order for every control created.
Callbacks could be tricky, because if you simply put the function into the callback for another control, depending on the exact situation, you could end up with the same stuff executing twice, which may or may not be problem, but is something you should be aware of.
So you'll have to decide whether you'll be assigning a function as a callback for both controls, or do something else. You could use a broadcaster to automatically update the values of the simplified slider whenever the main control changes (attaching controls could be automatized with the helper function). The helper function should also let you automatize the assignment of a control callback for the simplified sliders: this would be an inline function defined outside of the helper function, which would be calling .changed() of the main slider. You could also automate the targeting of the correct pair component via ID by deciding on a naming scheme (e.g.
Slider1_main
andSlider1_simplified
) and using the component argument of the callback function to get the target.This not only simplifies your code by letting you only worry about the true functionality of a single callback function per control, but calling changed() for the main slider makes sure that that particular component gets set as "last touched" for the DAW, letting you maintain the mirage of it all being a "single control".
Another way would be to actually be using only a single set of controls, storing dimensioning and positioning data into JSON, creating a switch in your every LAF and changing all these properties when the simplified GUI button gets clicked. Depending on your GUI setup, you might also have to reparent controls (can you even do this beyond on init?), so this approach doesn't scale super well and would need a bit of tailoring for each individual GUI.