iPlug2 Forum

Any way to make controls advance descending vs. ascending?

“InitDouble” controls work properly if the number increases numerically from minValue to maxValue. For example, 10Hz to 1000Hz, -10dB to +10dB, etc.

But there are sometimes needs for “reverse” action whereby the number goes down as the control is advanced. For example, 100mS to 1mS (slow to fast).

Is there a way to make an InitDouble control behave like that?

With InitDouble you can set the initial and final value, as well as the step… so I’m guessing that if you make the initial value larger than the final value, and the step a negative number then I suppose it should work as you need.

For example:

GetParam (kLevel)-> InitDouble ("Level",50.,100.,0.,-0.1,"%");

Where 50 is the default value, 100 is the value with the control at its minimum, 0 at its maximum, and decreasing by -0.1 as the knob is dialed up.

I thought that might work too - tried it - but it doesn’t. Using what you show the parameter value “sticks” at 99.9 for all position of the control.

Mmh, you’re right… what you can always do is to have a “normal” parameter and then calculate (1 - value) of this parameter to use it the way you intend. But obviously, you will have to draw the value manually next to the control.

Yes, that’s what I am doing. I was hoping there was a better/direct means so that automation data shows up properly.

I looked at overriding the control but it starts to get a little messy and I’m not sure what problems it could cause elsewhere.

Too bad the negative increment trick doesn’t work. That seems logical (and simple!).