Referencing revisited

Discuss Lemur and share techniques.
Post Reply
joebataz
Regular
Posts:154
Joined:28 Feb 2012 16:50
Location:Anthem, AZ USA
Contact:
Referencing revisited

Post by joebataz » 01 Jul 2014 02:20

In my project are 2 interfaces, Faders and Sequencer.
In Faders is a fader named XFade
In Sequencer is a fader named XFadeGhost

I would like these faders to have the same value. If I move XFade I want the x value to be the same in XFadeGhost. If I move XFadeGhost I want XFade x value to be the same.

WITHOUT using an OnFrame construct how do I get these 2 faders to see each other? I have triede multiple combinations of findobject, setattribute, etc. and I just can't get the value from one into the other without using a global variable and an OnFrame construct.

TIA for any help!!

Thanks,

joeb

Joe Soap
Regular
Posts:475
Joined:07 Jul 2012 15:04

Re: Referencing revisited

Post by Joe Soap » 01 Jul 2014 04:43

Use an Alias?

Macciza
Regular
Posts:1325
Joined:07 Dec 2011 04:57
Location:Sydney, Australia.

Re: Referencing revisited

Post by Macciza » 01 Jul 2014 07:40

One approach is to use execution as a 'listener' ...
Under XFade set up a script called setval executing on expression XFadeGhost.x - x = XFadeGhost;
Mirror the script with alternate names in the other object
Essentially the script listens to the expression and sets the local x to that value when it changes.....
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]

Softcore
Regular
Posts:1639
Joined:04 Nov 2012 08:34

Re: Referencing revisited

Post by Softcore » 01 Jul 2014 12:46

Change both faders physics from the default "interpolate" to "none"

Add script in XFade, on expression x, any

if (z) XFadeGhost.x=x;


add script in XFadeGhost, on expression x, any

if (z) XFade.x = x;

Softcore
Regular
Posts:1639
Joined:04 Nov 2012 08:34

Re: Referencing revisited

Post by Softcore » 01 Jul 2014 12:50

Also this might work with any physics desired

Add script in XFade, on expression x, any

if (!XFadeGhost.z) XFadeGhost.x=x;


add script in XFadeGhost, on expression x, any

if (!XFade.z) XFade.x = x;

Macciza
Regular
Posts:1325
Joined:07 Dec 2011 04:57
Location:Sydney, Australia.

Re: Referencing revisited

Post by Macciza » 02 Jul 2014 00:53

I find the opposite way a more objecty way of doing things....
Ie the Fader that is changing has the code to change itself based on the execution expression
This way looking at the object itself shows what it does, rather then another object controlling it which you need to find...
It keeps all the objects actions encapsulated in itself making moving or duplicating much simpler as well....
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]

Softcore
Regular
Posts:1639
Joined:04 Nov 2012 08:34

Re: Referencing revisited

Post by Softcore » 02 Jul 2014 06:22

Indeed, I cant argue with that! ;)

joebataz
Regular
Posts:154
Joined:28 Feb 2012 16:50
Location:Anthem, AZ USA
Contact:

Re: Referencing revisited

Post by joebataz » 16 Jul 2014 23:48

Youse guys!!!

That's why I love this forum, multiple answers. But I found the easy one;

LEARN HOW TO SPELL!!!
(Smack! the sound of a well placed smack to my forehead)

Thanks folks! Maybe I shouldn't have taken 3 engineering classes at the same time and get sleep instead...

Best to all,

Joe B

vav
Newbie
Posts:6
Joined:26 Jul 2014 02:14

Re: Referencing revisited

Post by vav » 29 Jul 2014 02:24

Macciza wrote: Under XFade set up a script called setval executing on expression XFadeGhost.x - x = XFadeGhost;
Mirror the script with alternate names in the other object
For anyone as literal minded as me, and as clueless about obvious scripting stuff . . . Play with it instead of wondering what assigning "XFadeGhost" to "XFadeGhost.x - x" might mean. Doh! I thought maybe that actually worked in Lemur. :oops:

"on expression XFadeGhost.x any" -- listen for any change to that x
"set local x to XFadeGhost.x" -- and take its value

So any reason not to use an alias if this is all you need? I can see how you'd want to start from this to get fancier than simply syncing x value.

Post Reply