Page 1 of 1
Can I have 2 different objects update each other?
Posted: 05 May 2012 08:29
by L05
Hello,
I have two objects, one fader and one knob, that both send MIDI messages to the same target but are located on different pages. When I adjust one, I'd like to have it update the other, but I'm running into a problem.
If I set knob.x to update fader.x when the knob is adjusted, it works, but if I also set fader.x to update knob.x when the fader is moved, they lock up in a loop of trying to update each other. Does anyone have any suggestions?
Thanks
-L05
Re: Can I have 2 different objects update each other?
Posted: 05 May 2012 11:54
by mat
Hey,
it should work if you do it in 2 seperate scripts. The script that updates the fader is executed on Knob.x and the script for knob is executed on Fader.x. that should break the feedback loop. (Making both execute on frame or putting both into same script can cause trouble)
Hope that helps
mat
Re: Can I have 2 different objects update each other?
Posted: 05 May 2012 11:58
by bxsj
You might consider creating a variable that gets set when one object is updating the other. Then query the variable in the other object so suppress the adjustement of the first object. And vice versa.
More elegant would be to create only one object and then create the second object as an alias. But this works only with the same type of object.
Hope that makes sense,
B.
Re: Can I have 2 different objects update each other?
Posted: 05 May 2012 20:41
by L05
Mat: I tried that route and set each of the scripts to execute on expression, but they still freeze in a feedback loop because simply changing the x variables cause the scripts to execute.
BXSJ: I'll try that right now and post the results.
Thank you both of you for responding.
Re: Can I have 2 different objects update each other?
Posted: 05 May 2012 21:36
by L05
Hm, I'm not sure how to get that to work. Is there a way to query whether or not an object is being touched? Can you post an example if possible? Thanks in advance.
Re: Can I have 2 different objects update each other?
Posted: 06 May 2012 15:25
by bxsj
Here is an example of Mat's solution.
B.
Re: Can I have 2 different objects update each other?
Posted: 06 May 2012 20:57
by L05
Thanks for the response BXSJ. Unfortunately it doesn't work as desired.
The attached patch updates the knob successfully when the fader is adjusted, but when you move the knob it still up freezes in an update loop.
I feel for this to work, I'd need to be able register which object is being actively touched... thoughts?
If there was an additional variable on all of the objects that indicated whether or not an object is being touched, it'd be extremely useful for addressing a seemingly simple problem such as this. It'd also provide a gamut of options for interesting interface design.
Re: Can I have 2 different objects update each other?
Posted: 07 May 2012 10:44
by bxsj
Confirmed, this doesn't work as planned. It seems that this is a feature or a
bug (?!) of the Knob object. Using faders or ranges to control each other works fine, but not with knobs. Can somebody confirm and explain this behavior? Attached are a couple of examples.
The fader object has the "z" variable which set to 1 whenever the fader is touched, otherwise z = 0. The same applies to pads where the x value is set 1 when you press/touch the pad.
If there was an additional variable on all of the objects that indicated whether or not an object is being touched, it'd be extremely useful for addressing a seemingly simple problem such as this
That would be a good enhancement.
Cheers,
BxSj
Re: Can I have 2 different objects update each other?
Posted: 08 May 2012 16:04
by gbevin
I found that I could work around the feedback loop by checking of the variable is different:
Code: Select all
if(OSC_Tune2DualVCO.x!=x) OSC_Tune2DualVCO.x=x;
and on the other side:
This prior check prevents x from being updated when it's not needed, hence breaking the feedback loop.