get touchedParam's value before the "touch"?


is there a way to get the touchedParam value before it was pressed? for a knob/slider it works due to “slow” dragmove event called after onButton (which will be safe, but i would say not 100%).

if i have a button/switch, once i “touch” (i.e. i click the button), the paramQuantity’s getValue() of the touchedParam is the new value, not the prev one.

is there a elegant way to get the prev value before touch a param?


I suggest you create your own ParamQuantity and keep a copy of the old value there.

but touchedParam pointer is set on void ParamWidget::onButton(const event::Button& e) (i.e. within the core of Rack).

i get the reference from it, which I don’t have controls.

i meant “get the value of the first touch” of elsewhere params. is it more clear @stoermelder ?

Please try to explain what you trying to achieve. Not sure if touchedParam is the way to go.


i try :slight_smile:

here’s an example using your module. recordings on MIX4 mute 1 (button value on = 1.0):

when i click and keep press, the recording must be 1.0f (first sample), than 0.0 (storing the “original” button value before the click), but instead it simply set 0.0 to all the recordings:

thus: i need the value before the touch and rec the follow :slight_smile: more clear? thanks

I see. I don’t think accessing the value before touching the parameter will solve this problem. Right now I believe „touch“ recording of any push buttons might be the wrong solution.

If the button/switch has only 2 values, just take the opposite value.