Hopefully someone can help me here. I'm trying to use a fader to send midi CC values. Got that working. I've got some switches with labels corresponding to the CC I want to send. I've got things working with sending my cc value to a .cc variable on my fader and then using that for the ctlout. But I'd like to simplify things. Right now my script from the switches uses if and else if lines for each switch (there are 12 of them). Is there a way to just set my fader variable by using a getattribute call to the 'labels' in the switches? something like this:
decl s;
s=firstof(x);
Fader2.cc=getattribute(Switches2,'labels',[s]);
I have a feeling I'm in the ballpark but something is wrong. Maybe it can't be done?
Thanks so much!!!!
Steve
trying to get attribute from switch labels....
-
- Newbie
- Posts: 16
- Joined: 08 May 2013 14:27
Re: trying to get attribute from switch labels....
When you get the labels attribute, lemur returns a array. So your right using [s], but you have to put it outside the get attribute like this:
The only problem I can think of is that it returns a string instead of an integer, so it might nog work on a ctl out. If you got that problem, you can just create an expression with all the cc's in them and use the switch to select the one something like this:
Code: Select all
Fader2.cc=getattribute(Switches2,'labels')[s];
Code: Select all
ccs = {1,2,3,4} //This expression holds the cc's
ctlout(0,css[firstof(Switches.x)],127,1); // This should be inside the script.
"Having no silence in music is like having no black or white in a painting" - Brian Eno
https://soundcloud.com/mrcorba
https://soundcloud.com/mrcorba