One script to rule them all
Posted: 17 Jun 2012 18:47
So I finally figured out how to make a fader output 14bit MIDI messages. Now it's time to fill my screen with unlimited faders to control the parameters I wish to control. (again, I'm new to scripting so please bare with my layman's terminology) First lets start with the script I wish to master:
decl target=1; // MIDI Target
decl nrpn_msb = 99, nrpn_lsb = 98; // NRPN MSB - LSB
decl data_msb = 6, data_lsb = 38; // DATA MSB - LSB
decl nrpn_param = 15;
decl null=0, value; //VARS
decl chan = 1; // MIDI Chan
value= Fader.x*164; // value * range
ctlout(target,nrpn_msb,null,chan); // CC: NRPN MSB
ctlout(target,nrpn_lsb,nrpn_param,chan); //CC: NRPN LSB
if(value<=127)ctlout(target,data_msb,null,chan); //CC: Data Entry MSB for 1st 7 bits or...
if(value>127)ctlout(target,data_msb,null+1,chan); //CC: Data Entry MSB for 2nd 7 bits
if(value<=127)ctlout(target,data_lsb,value,chan); //CC: Data Entry LSB for 1st 7 bits or...
if(value>127)ctlout(target,data_lsb,value-127,chan); //CC: Data Entry LSB for 2nd 7 bits
Is there a way I can have this script written once, and then to have different variables set inside so that different faders will control different parameters, or will each fader have to have it's own script nested in it's branch in the project panels hierarchical? Does anyone understand what the heck I'm asking, if so can you point me in the right direction?
decl target=1; // MIDI Target
decl nrpn_msb = 99, nrpn_lsb = 98; // NRPN MSB - LSB
decl data_msb = 6, data_lsb = 38; // DATA MSB - LSB
decl nrpn_param = 15;
decl null=0, value; //VARS
decl chan = 1; // MIDI Chan
value= Fader.x*164; // value * range
ctlout(target,nrpn_msb,null,chan); // CC: NRPN MSB
ctlout(target,nrpn_lsb,nrpn_param,chan); //CC: NRPN LSB
if(value<=127)ctlout(target,data_msb,null,chan); //CC: Data Entry MSB for 1st 7 bits or...
if(value>127)ctlout(target,data_msb,null+1,chan); //CC: Data Entry MSB for 2nd 7 bits
if(value<=127)ctlout(target,data_lsb,value,chan); //CC: Data Entry LSB for 1st 7 bits or...
if(value>127)ctlout(target,data_lsb,value-127,chan); //CC: Data Entry LSB for 2nd 7 bits
Is there a way I can have this script written once, and then to have different variables set inside so that different faders will control different parameters, or will each fader have to have it's own script nested in it's branch in the project panels hierarchical? Does anyone understand what the heck I'm asking, if so can you point me in the right direction?