Page 1 of 1
How to sort an LED array backwards quickly?
Posted: 17 Nov 2013 18:00
by electrofux
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?
Re: How to sort an LED array backwards quickly?
Posted: 18 Nov 2013 05:47
by Macciza
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
Re: How to sort an LED array backwards quickly?
Posted: 18 Nov 2013 13:59
by electrofux
Thx, inverting the colours did the trick
Glad i could spare a couple of scripts. I am currently fighting the size limit again and think twice about adding an element or even scripts.
Re: How to sort an LED array backwards quickly?
Posted: 18 Nov 2013 21:25
by Macciza
no worries
Could possibly have a look at your project to pare it down if you want ...
Re: How to sort an LED array backwards quickly?
Posted: 19 Nov 2013 15:21
by electrofux
Thx for the offer. I am currently cleaning it up and will post it anyways.
Re: How to sort an LED array backwards quickly?
Posted: 26 Nov 2013 17:00
by electrofux
Just an example where i think i might save some space:
Code: Select all
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?
Re: How to sort an LED array backwards quickly?
Posted: 27 Nov 2013 11:41
by oldgearguy
Couldn't you use a common script and for each track do a getobject() and then pass the object (along with any other specific info) to the common script?