Page 1 of 1

Turn "off" all switches in an array?

Posted: 19 Mar 2012 16:30
by Xenophile
Is there a way turn "off" all the switches in an array of radio buttons?
I have an array of radio buttons that I'm using to send program change messages to a midi synth.
I use another array to send bank change messages. I'd like to have the Program buttons all return to "off" (null?) state whenever I press a bank change button.

For example: RIght now, if I have Bank 1 and Program 1 selected, and I press the Bank 2 button: The Program 1 button stays "on" but the synth doesn't change patches because it is still waiting for a Program Change message to follow the Bank Change (Program Change message are ony sent when I press a Program button). If I want Bank 2 Program 1, I can't simply press the Program 1 button, because Lemur thinks it is already "on." I need to press a different Program number button, and then press Program 1.

I tried this in a script that runs when I press a Bank_Change button:
decl current=firstof(Program_Change.x);
set(Program_Change.x,0,current);

It doesn't complain, but it doesn't work either. The currently "on" Program button stays "on." Maybe 0 isn't the right value to set? Is there a way to set the desired element's value to "null" (assuming "null" does not equal 0)?

Thanks!

Re: Turn "off" all switches in an array?

Posted: 19 Mar 2012 17:23
by mat
Hey Xenophile,

Try following script: on expression - Bank_Change.x - any

Code: Select all

Program_Change.x=0;
it will set all Program_Change buttons to 0

you can also adress single swiches within a vector or set all to 0 (below for 4x4)

Code: Select all

Program_Change.x={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
However, firstof() will get a variable change on this. It jumps to 16 in my 4x4 tryout.
That could lead to misstriggering an prg change, right?
Not sure, depends a bit on how you send the message.

hope that helps
mat

Re: Turn "off" all switches in an array?

Posted: 19 Mar 2012 18:01
by Xenophile
mat wrote:Try following script: on expression - Bank_Change.x - any

Code: Select all

Program_Change.x=0;
it will set all Program_Change buttons to 0
That works. I was making it more complicated that it needs to be. Thanks!