I have a switch that I would like to control with midi. I have 4 movie TOPS wired into a switch. I have a constant CHOP connected to a speed CHOP limited to 4 and that channel value exported to my switch index. I want to be able to push button 1 on my controller and have the switch increment to movie one. If I press button 3, i want to increment the index to 3 etc. This is all working if I manually change the constant CHOP I’m just stuck on how to specify the amount/number for my MIDI buttons. I am testing with MIDI currently, but this control might later change to touchscreen buttons. Not sure if the technique would change at that point…
Solved, sort of:
constant to math CHOP, math premultiply to 3, MIDI output mapped to constant chan1, switch index mapped to math chan1.
It’s not exactly what I want. I’d rather be able to push one button on midi to switch to 1 movie, another button to switch from there to movie 3 etc as the slider is inaccurate (can overshoot), but will work for now.
When you set the Fan CHOP’s Operation parameter to Fan In, when given an input with a number of channels equal to 0, it will output the index of any channel that is not equal to 0.
So for your case, use a Merge CHOP to gather all the channels that are controlled by midi, then plug that Merge CHOP into the Fan CHOP. Make sure the channels rest at 0 when not selected.
Now if the 2nd channel is non-zero, the result will be 1, when the 8th channel is non-zero, the result will be 7 (remember that indices in CHOPs are 0-based). The Fan CHOP is the perfect CHOP to control a Switch operator’s Index parameter.