Turn "off" all switches in an array?

Discuss Lemur and share techniques.
Post Reply
Xenophile
Newbie
Posts: 13
Joined: 08 Feb 2012 20:58

Turn "off" all switches in an array?

Post 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!
mat
Regular
Posts: 124
Joined: 08 Dec 2011 09:21
Location: Germany
Contact:

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

Post 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
Lemur modules and sequencer: http://music-interface.com
Setup: Win7professional 32bit, Intel Core 2 Duo @ 2,66 GHz.,Tascam US-144MKII, Ableton Live 8.4,
Arturia Analog Lab., Max/Msp, Maxforlive, Lemur Legacy + Ipad, Akai MPK61, Doepfer Pocket Control
Xenophile
Newbie
Posts: 13
Joined: 08 Feb 2012 20:58

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

Post 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!
Post Reply