Easy way to add multiple fader numbers to script?

Discuss Lemur and share techniques.
Post Reply
alloedee
Regular
Posts: 55
Joined: 29 Dec 2012 12:35

Easy way to add multiple fader numbers to script?

Post by alloedee »

Hello there.

Iam an working on some templates, with many multisliders and faders. In the template there is some reset/normalize buttons.

Iam using this script for resetting the sliders:

Code: Select all

MultiSlider.x=0.0;
But I was wondering if it is possible to make some kind of specific interval, like MultiSider1-Multislide32.x=0.0; so I dont need to inset all the numbers manually.

Example of that I have done so far for one reset button:

Code: Select all

MultiSlider33.x=0.0;
MultiSlider34.x=0.0;
MultiSlider35.x=0.0;
MultiSlider36.x=0.0;
MultiSlider37.x=0.0;
MultiSlider38.x=0.0;
MultiSlider39.x=0.0;
MultiSlider40.x=0.0;
MultiSlider41.x=0.0;
MultiSlider42.x=0.0;
MultiSlider43.x=0.0;
MultiSlider44.x=0.0;
MultiSlider45.x=0.0;
MultiSlider46.x=0.0;
MultiSlider47.x=0.0;
MultiSlider48.x=0.0;
MultiSlider49.x=0.0;
MultiSlider50.x=0.0;
MultiSlider51.x=0.0;
MultiSlider52.x=0.0;
MultiSlider53.x=0.0;
MultiSlider54.x=0.0;
MultiSlider55.x=0.0;
MultiSlider56.x=0.0;
MultiSlider57.x=0.0;
MultiSlider58.x=0.0;
MultiSlider59.x=0.0;
MultiSlider60.x=0.0;
MultiSlider61.x=0.0;
MultiSlider62.x=0.0;
MultiSlider63.x=0.0;
MultiSlider64.x=0.0;
alloedee
Regular
Posts: 55
Joined: 29 Dec 2012 12:35

Re: Easy way to add multiple fader numbers to script?

Post by alloedee »

Bump,

I really need to find out if this is possible or not. Before I use alot of time on something stupid.

Plz help
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: Easy way to add multiple fader numbers to script?

Post by Macciza »

Hi
One way to do it is by using the findobject(name) or getfirst(object) functions to locate where you want to start . . .
And then use getnext(object) to step through the hierarchy . . .

Have a look at the while loop example in the User Manual . . .

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: 1613
Joined: 04 Nov 2012 08:34

Re: Easy way to add multiple fader numbers to script?

Post by Softcore »

I have bumped into a lot of occations where I needed such a function and I cant for the life of me, figure out what Im coding wrong here....

I've used 5 knobs in the example template but of course I would use such a code on a larger scale (more objects to be set)

What the hell am I doing wrong??

button, on expression x, risign from 0

Code: Select all

decl obj,i;
obj=findobject(Knob1); 
i=0;
while (i<5)
{
setexpression(obj,x,0.2);
getnext(obj);
i++;
}
I then press the button but the knobs do not change expression x.

here's the example template....6 knobs are in there, I want to make the 5 change (I put the 6th in there just to be sure I have the code correct, its supposed to stay untouched)
Attachments
repeated_expression_setting.jzml
(13.22 KiB) Downloaded 56 times
lABl
Lemur Guru
Posts: 269
Joined: 09 Dec 2011 15:56
Contact:

Re: Easy way to add multiple fader numbers to script?

Post by lABl »

Attached an example, try with objects inside of container.

I got a finished project I wanted to release full of examples with kind of code,

Hope that helps,
Cheers,
Attachments
Example.jzlib
(12.71 KiB) Downloaded 70 times
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: Easy way to add multiple fader numbers to script?

Post by Softcore »

Ok I think I 've figured it out....

This works!

Code: Select all

decl obj,i;
obj=findobject('Knob1'); 
i=0;
while (i<5)
{
setexpression(obj,'x',0.2);
obj=getnext(obj);
i++;
}
Is there a more elegant, shorter code for this function or is this the best it can get?

the example template for anyone needing it...

Oooops just saw your post AB, thanks I 'll definitely check it out!
Attachments
repeated_expression_setting-fix.jzml
(13.76 KiB) Downloaded 60 times
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: Easy way to add multiple fader numbers to script?

Post by Softcore »

I saw your example AB...Dont think Im a lazy guy - I have already seen this approach in the Lemur manual - i wanted to make it work outside a container! ;)

EDIT: I think this one is even better than my previous one.....

Code: Select all

decl obj = Knob1; 
while (obj!=Knob6)
{
setexpression(obj,'x',0.2);
obj=getnext(obj);
}
Last edited by Softcore on 07 Mar 2013 14:45, edited 2 times in total.
lABl
Lemur Guru
Posts: 269
Joined: 09 Dec 2011 15:56
Contact:

Re: Easy way to add multiple fader numbers to script?

Post by lABl »

Ah no problem, so you are ready to go now ;)
Post Reply