Can I have 2 different objects update each other?

Discuss Lemur and share techniques.
Post Reply
L05
Newbie
Posts: 11
Joined: 24 Apr 2012 04:10
Location: Ann Arbor, MI
Contact:

Can I have 2 different objects update each other?

Post 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
mat
Regular
Posts: 124
Joined: 08 Dec 2011 09:21
Location: Germany
Contact:

Re: Can I have 2 different objects update each other?

Post 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
Lemur modules and sequencer: http://music-interface.com
Setup: Win7professional 32bit, Intel Core 2 Duo @ 2,66 GHz.,Tascam US-144MKII, Ableton Live 8.4,
Arturia Analog Lab., Max/Msp, Maxforlive, Lemur Legacy + Ipad, Akai MPK61, Doepfer Pocket Control
bxsj
Regular
Posts: 116
Joined: 24 Dec 2011 06:47
Location: Vienna

Re: Can I have 2 different objects update each other?

Post 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.
Win7 64, Ipad Lemur, Cubase6 and a bunch of Roland Synths and Samplers
L05
Newbie
Posts: 11
Joined: 24 Apr 2012 04:10
Location: Ann Arbor, MI
Contact:

Re: Can I have 2 different objects update each other?

Post 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.
L05
Newbie
Posts: 11
Joined: 24 Apr 2012 04:10
Location: Ann Arbor, MI
Contact:

Re: Can I have 2 different objects update each other?

Post 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.
bxsj
Regular
Posts: 116
Joined: 24 Dec 2011 06:47
Location: Vienna

Re: Can I have 2 different objects update each other?

Post by bxsj »

Here is an example of Mat's solution.
B.
Attachments
test2.jzml
(4.65 KiB) Downloaded 104 times
Win7 64, Ipad Lemur, Cubase6 and a bunch of Roland Synths and Samplers
L05
Newbie
Posts: 11
Joined: 24 Apr 2012 04:10
Location: Ann Arbor, MI
Contact:

Re: Can I have 2 different objects update each other?

Post 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.
bxsj
Regular
Posts: 116
Joined: 24 Dec 2011 06:47
Location: Vienna

Re: Can I have 2 different objects update each other?

Post 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
Attachments
test3.jzml
(20.57 KiB) Downloaded 92 times
Win7 64, Ipad Lemur, Cubase6 and a bunch of Roland Synths and Samplers
gbevin
Newbie
Posts: 7
Joined: 06 May 2012 18:31
Location: Belgium
Contact:

Re: Can I have 2 different objects update each other?

Post 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:

Code: Select all

if(OSC_Tune2.x!=x) OSC_Tune2.x=x;
This prior check prevents x from being updated when it's not needed, hence breaking the feedback loop.
iMac Core i7 2.93 GHz 8GB SSD 10.7.x, Liine Lemur iPad1/iPad 3, Eigenharp Alpha, Metric Halo, Plogue Bidule, PianoTeq, Omnisphere, u-he Diva, NI Komplete 8, Moog Slim Phatty
Post Reply