General
trying to get attribute from switch labels....
Started by stevendieveney on .
Sign in or create an account to join the conversation.
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',);
I have a feeling I'm in the ballpark but something is wrong. Maybe it can't be done?
Thanks so much!!!!
Steve
decl s;
s=firstof(x);
Fader2.cc=getattribute(Switches2,'labels',
I have a feeling I'm in the ballpark but something is wrong. Maybe it can't be done?
Thanks so much!!!!
Steve
When you get the labels attribute, lemur returns a array. So your right using , but you have to put it outside the get attribute like this:
Fader2.cc=getattribute(Switches2,'labels')[s];
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:
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.