Page 1 of 1

Change dinamically midi channel from Switches object

Posted: 12 Jan 2014 18:20
by ecce_cello
hallo,

how can i change channel out of "Switches1" object using a "Switches2" object? When "Switches2" is ON, "Switches1" outputs CC in channel 1, when "Switches2" is off, "Switches1" outputs CC in channel 2.

i hope this is easier and clearer, the other thread i wrote is just a mess (i had never tried to solve something in a forum, and had so many fail attempts and misunderstandings in a single post!).

one thousand thanks.

david

Re: Change dinamically midi channel from Switches object

Posted: 13 Jan 2014 12:11
by electrofux
If you look at the last example for the On/Off switch, you see the script where you make the midiout (ctlout(1,c,x*127,1)). The last "1" is the Midi Channel.
So, you can declare a variable called midichannel ("decl midichannel;") beforehan then make another "if clause" asking for the state of Switch3: if (Switch3.x==0) {midichannel=1;}else{midichannel=2;}.

Then you go ctlout(1,c,x*127,midichannel) so that the midiout channel is determined by the setting of Switch3.