Open hemmer opened 5 months ago
I think it could be done easily. The minAngle/maxAngle fields of rack::app::Knob could be captured and stored in the MetaModule Element type. Then the element draw/redraw functions would use this instead of their default angles. At least, this is easy in the dynamic_loader branch. The main branch would be a bit more tricky since I'm assuming that bit of code is in the ModuleWidget constructor so we'd need to capture the min/max values in ModuleWidget::addParam.
More specifically:
min_angle
and max_angle
fields to MetaModule::Knob
in base_element.hh, with default values (300 degrees total sweep, centered at noon is how it's drawn now). This might trigger some warnings about missing braces wherever a Knob is constructed with an initializer listredraw_element(const &knob, ...)
in gui/elements/redraw.hh
(note that LVGL natively uses integers for angles such that 3600 = 2*PI)make_element(rack::app::SvgKnob *, ...)
and make_element(rack::componentlibrary::Rogan*, ...)
in vcv_plugin/src/make_element.cc
add the minAngle and maxAngle fields of the widget to the Knob's initializer listVCV_adaptor/app/ModuleWidget.hpp
we'd need a new overload for addParam
like addParam(app::Knob *widget)
. Then in this function we could do a std::visit on the widget->element that sets the min_angle and max_angle fields if the variant type is MetaModule::Knob, and does nothing otherwise. Then the same stuff that happens in the other addParam()
would need to happen.I think that's all it will take
Thanks I'll try and take a look
@hemmer Is this still relevant? I was thinking of doing it unless you've made any progress.
Since it would be an API change for plugins, we would need to roll it into SDK API v1.1.
Ah sorry I don't think I still have those changes, and it'll be a little while before I get the chance to look at it properly. It may be easiest (and faster with your understanding) if you do it - sorry I never got round to it!
Note: while adding fields to Knob, we might want to add snap (boolean), units (string), base, multiplier, and offset to ParamElement.
I'm updating the Befaco modules for recent updates on VCV side. All going well, but for one case, the knob has a custom range for the knob:
Is this or can this be supported on the metamodule side? I can try to implement if you point me in the right direction. If not I can make the Befaco metamodule branch remove these lines.