So I’m looking at overriding on hover to link the inverse of another knob when the opposite knob is hovered && switch engaged. Issue at the moment with doing the following:
if (params[LINKMINMAX_PARAM].getValue() < 1.f) {
params[MAX_PARAM].setValue(-params[MIN_PARAM].getValue());
params[MIN_PARAM].setValue(-params[MAX_PARAM].getValue());
} /***else*/
This stops both knobs working.
What I would like to do is this: (without needing to use the switch to enable which one is the slave.)
if (params[LINKMINMAX_PARAM].getValue() < 1.f) {
params[MAX_PARAM].setValue(-params[MIN_PARAM].getValue());
} //*** else onHover of MAX_PARAM do opposite as one is master other is slave
else params[MIN_PARAM].setValue(-params[MAX_PARAM].getValue());
The else part becoming an else if (… && onHover of max)
What would be the best way to do so.
The switch will link the inverse but when it is not engaged both knobs should work like normal.
Couldn‘t you simply store which knob has been clicked?
If you don‘t want to depend on ui interaction you could also remember the previous value of the knobs and determine which one has changed, I guess.
Would need on mouse down event to it that way I think. onHover I think is more ideal or onHoverDrag possible more so as just mousing over would probably cause an issue.
What would you do to store the click?
Just saw the edit. As one is dragging the other that value would be always changing, no?
Hmm dunno about that way, that seems less simpler than onHover. My thinking being once it detects being hovered it will step into the else part if the users decides not to drag or moves off the param it steps back to the if.
Something worth mentioning is the setter being locked is only the param locking up the actual value will change. So if I was to change the locked param and enable the switch so the getter is now the value changed, the other knob will change to the inverse value.
Like so:
So that’s partly why I’m thinking onHover when the link is enabled
I had not thought of MIDI-Map or stoermelder’s CV Map’s on the param’s. But they do indeed mess with the locked up setter in a bad way (I’ll pass that bridge when I come to it).
Probably even more of a reason to use onHover. When either are not hovered control can be normal.
Hope I have explained correctly that I want to use onHover as I feel this would be the more direct approach. I’m thinking something along the lines of this:
if (params[LINKMINMAX_PARAM].getValue() < 1.f &&
theMinParam_isHovered) {
//setter is the min param
params[MAX_PARAM].setValue(-params[MIN_PARAM].getValue());
} else if (params[LINKMINMAX_PARAM].getValue() < 1.f &&
theMaxParam_isHovered) {
//setter is the max param
params[MIN_PARAM].setValue(-params[MAX_PARAM].getValue());
}
I do appreciate the help here and thanks for the input, but it’s pretty simple to control the knob automatically from another knob and I’m clearly doing so. It is overriding onHover to pass the control I’m stuck on.
I know there is more than one way to skin a cat I want to skin it on hover
Might have to rethink it and rearrange the GUI a bit. The other switch is supposed to pad both values by a certain amount but .setValue(val - pad) and .setValue(-val + pad) will disable the knobs from turning. Once you call set there is no turning back (pun intended)
There doesn’t seem to be a way to set and have control at the same time without using some sort of event.
@Vortico care to elaborate a little more? Is there a different event that would better suit. As it is a mouse controls everything in rack or more appropriately a single point what would be the best event to use to determine what should set a what should get.
It is a limitation of setValue() only being able to set one thing at a time that is the determining factor in using the event system to set, it is the most logical solution as it is either true or false that the mouse will be under that knob at any given time.
I have tried your solution but it seems that it is doing the same thing as mine you lose control of one knob. Unless I have interpreted it wrong:
volt1 = params[MAX_PARAM].getValue();
volt2 = params[MIN_PARAM].getValue();
// process():
if (volt1 != prevMax) {
volt2 = -volt1; //sets display value but not knob, lose control of knob still
//params[MIN_PARAM].setValue(-volt1);
prevMax = volt1;
} else if (volt2 != prevMin) {
prevMax = -prevMax;
prevMin = volt2;
}
Have you? You just said it is a horrible solution I’m asking if there is a better one based on that statement. I’m saying using the event system is the only viable solution as setValue can only do one knob at a time, you lose control of the other knob.
@Vortico Based on not finding an easy solution would it be worth having a method that can find which param is being hovered in the API?
ideally
if (param[this_param].isHovered() && param[link_param].getValue() > 0.f){
param[that_param].setValue(-param[this_param].getValue)
} else if (...) {...}
Use case would be thread title. Other use cases could be linking mixer channels to change stereo paired channels when either is changed or Mutes/Solo’s/AUX/Pan. Syncing settings on a stereo delay. Tuning a fixed filter or multi band EQ from any param. Recalling snapshots while still having the ability to edit parameters and or save.
I‘m not sure if you really need this? What‘s wrong with vortico‘s suggestion of tracking which value has changed?
Thinking one step further, when using Rack on a touch display „isHovered“ won‘t be helpful.