Hi guys, i came to call for help at this stage… i would like to create an encoder that can do exactly what i describe in the tittle, at this time, i use two buttons one + and one - … but i couldnt find an exemple of this kind of encoder… please
I don’t understand, please elaborate.
this is it
i found the code block for the solution A… but couldnt find for the solution i choose for my ui … by the way andrew, thx to the others members, i progress quite fast those days
Give your parameter infinite range (from -INFINITY
to INFINITY
) and default value of 0.f
. Initialize a Module
member variable to 0.f
. In your step()
function (now called process()
in Rack v1), the difference between the parameter’s value and your variable is the change of the parameter during that timestep. Finally, set your variable to the parameter value so the change is ready for the next timestep. E.g.
float value = params[...].value;
float deltaValue = value - lastValue;
lastValue = value;
thx you very much,
without abusing, do you know any module that use that function ? to get a exemple… i better learn by exemple i do understand half of what you said… i mean, i know how to set params, init the module, ok, but also because i use 0.6.2, how to find this process ?
I don’t recall any open source ones, no.
i got it mate !!! super… so happy !
I want to do similar for a scrub knob to scrub back and forth through a buffer. I’ve done the -inf / inf thing in configParam which gives me an infinitely turning knob, now I need the value to be between 0.f and (say) 10.f, I’ve tried setting the param value to zero when >= 10 and to 10 when less than zero (in process()) but that causes the knob to jump around erratically as soon as either of those conditions are satisfied.
Grateful for any suggestions.
You can just compute std::fmod(params[...].getValue(), 10.f)
to give you a value between 0 and 10 for infinite encoders.
Ok, thank you, that works, but then the tooltip for the knob shows a different value to the one I’m using, any way around that?
You can create your own ParamQuantity
that displays anything you want on the tooltip.
Thanks Ben, any chance of a super simple example of that?
I honestly wouldn’t worry about it.
I’m well out of practice, but I come from an engineering background where displaying a wrong number could result in very interesting times, so it’s gonna bug me
Maybe something like
struct MyParamQuantity : ParamQuantity {
float getDisplayValue() override {
return std::fmod(ParamQuantity::getDisplayValue(), 10.f);
}
};
configParam<MyParamQuantity>(...);