General
Turn "off" all switches in an array?
Started by Xenophile on .
Sign in or create an account to join the conversation.
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!
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!
Hey Xenophile,
Try following script: on expression - Bank_Change.x - any
you can also adress single swiches within a vector or set all to 0 (below for 4x4)
That could lead to misstriggering an prg change, right?
Not sure, depends a bit on how you send the message.
hope that helps
mat
Try following script: on expression - Bank_Change.x - any
Program_Change.x=0;
it will set all Program_Change buttons to 0you can also adress single swiches within a vector or set all to 0 (below for 4x4)
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
That works. I was making it more complicated that it needs to be. Thanks!mat wrote:Try following script: on expression - Bank_Change.x - anyit will set all Program_Change buttons to 0Program_Change.x=0;