Troubleshooting

How to sort an LED array backwards quickly?

Started by electrofux on .

Sign in or create an account to join the conversation.

7 posts

Topic starter
Hello,

i want to diplay the Mixer Vu Meters of Reason (sending CC values from 0to31) as 16 segmented LEDs. But currently the LEDs light from the top to the bottom instead of bottom up.
I tried reverting the scaling but that didnt work. But what would an efficient script look like?
Hi

A quick solution is to setup an Leds to 16 rows, and BarGraph On, then invert the colours so Color Off is what you want to see . . .
then reverse the scale in the midi mapping panel to be 127 - 0 and all should be good . . . .

The other options involve a bit if scripting but can provide fancier features and such ….

Cheers
Just an example where i think i might save some space:
decl state,step,i;
for (i=0;i<16;i++)
{
state=drumtrack1[27+i];
step=i;
if (state!=0)
{Pads27.rowcolor[step]=red;
setattribute (Pads27,'colors',Pads27.rowcolor);}
else
{Pads27.rowcolor[step]=row4b;
setattribute (Pads27,'colors',Pads27.rowcolor);}
}
for (i=0;i<5;i++)
		{
		if(i==drumtrack1[17]) {SequencerControls.Direction.x[i]=1;}else{SequencerControls.Direction.x[i]=0;}
		}
for (i=0;i<6;i++)
		{
		if(i==drumtrack1[16]) {SequencerControls.EditMode.x[i]=1;}else{SequencerControls.EditMode.x[i]=0;}
		}
for (i=0;i<20;i++)
		{
		if(i==drumtrack1[18]) {SequencerControls.AddSequControls.Rate.x[i]=1;}else{SequencerControls.AddSequControls.Rate.x[i]=0;}
		}
for (i=0;i<32;i++)
		{
		if(SequencerControls.AddSequControls.Pattern.ccstates[i]==drumtrack1[23]) {SequencerControls.AddSequControls.Pattern.x[i]=1;}else{SequencerControls.AddSequControls.Pattern.x[i]=0;}
		}
for (i=0;i<16;i++)
		{
		if(i==drumtrack1[24]) {SequencerControls.AddSequControls.LastStep.x[i]=1;}else{SequencerControls.AddSequControls.LastStep.x[i]=0;}
		}
SequencerControls.AddSequControls.OnOff.x=drumtrack1[25];
SequencerControls.AddSequControls.Routing.x=drumtrack1[26];
SequencerControls.AddSequControls.Swing.x=drumtrack1[19]/128;
Sliders.Slider1.x=drumtrack1[12]/128;
Sliders.Slider2.x=drumtrack1[13]/128;
Sliders.Slider3.x=drumtrack1[14]/128;
Sliders.Slider4.x=drumtrack1[15]/128;
Sliders.Slider5.x=drumtrack1[8]/128;
Sliders.Slider6.x=drumtrack1[9]/128;
Sliders.Slider7.x=drumtrack1[10]/128;
Sliders.Slider8.x=drumtrack1[11]/128;
Sliders.Slider9.x=drumtrack1[4]/128;
Sliders.Slider10.x=drumtrack1[5]/128;
Sliders.Slider11.x=drumtrack1[6]/128;
Sliders.Slider12.x=drumtrack1[7]/128;
Sliders.Slider13.x=drumtrack1[0]/128;
Sliders.Slider14.x=drumtrack1[1]/128;
Sliders.Slider15.x=drumtrack1[2]/128;
Sliders.Slider16.x=drumtrack1[3]/128;
This is the script that updates 1 of the 28 Step Sequencer tracks when i switch to them. Now the script looks exactly the same for all 28 tracks, apart from "drumtrack1". If i could make it drumtrackX and hand over the tracknumber i could make just 1 script instead of 28. But then i need arrays of arrays, do i?