Is possible to change configParam values on the fly?

Hi everyone!
So, I have this module with a switch that changes default min/max values for a knob.
Back in v0.6 it was all good as just rescaling the parameter value was needed to get the knob to work in both settings fine, now that the tooltips show the knob values the workaround works, but still shows the original config. Any way around this?

It might be possible, but doing so is currently an unsupported hack and might break in any update.

Thanks Andrew, don’t want to hack things again, so I’ll just leave it like that or remove the parameter change option.

I’ve worked around this by passing a custom ParamQuantity struct to Module::configParam and overriding getDisplayValueString for each ParamWidget with variable min/max. To prevent showing menu items in the tooltip that aren’t applicable, I override ModuleWidget::onButton and consume events if my ParamWidget bounding box contains e.pos.

Don’t know if this constitutes an “unsupported hack”, but it only uses public interfaces as far as I can tell.


Writing a custom ParamQuantity is technique that Andrew described when I asked how to do it. I do hope it’s not an unsupported hack, because the standard configParam stuff can do only linear and exponential tapers, and some of my knobs have other tapers.

1 Like

It can do logarithmic also see engine/ParamQuanity.hpp

/** Set to 0 for linear, positive for exponential, negative for logarithmic. */
1 Like

the answer is: NEVER call configParam (except in the module constructor).
I spent two days in tracking a very elusive bug, that was caused by calling configParam() AFTER the init phase. To add insult to injury, code works well under gdb but crashes as soon as you launch Rack without it. So, debugging was a nightmare. I believe (but I am only guessing) that the real problem is caused by a delete paramQuantity statement inside configParam. As soon as this code is executed, it is only a question of time before a segmentation fault (and putting a NULL after the delete statement -that is missing, btw- does not help.