How to sort an LED array backwards quickly?

Discuss problems and solutions.
Post Reply
electrofux
Regular
Posts: 294
Joined: 24 Jan 2012 18:22

How to sort an LED array backwards quickly?

Post 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?
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: How to sort an LED array backwards quickly?

Post 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
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
electrofux
Regular
Posts: 294
Joined: 24 Jan 2012 18:22

Re: How to sort an LED array backwards quickly?

Post 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.
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: How to sort an LED array backwards quickly?

Post by Macciza »

no worries

Could possibly have a look at your project to pare it down if you want ...
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
electrofux
Regular
Posts: 294
Joined: 24 Jan 2012 18:22

Re: How to sort an LED array backwards quickly?

Post by electrofux »

Thx for the offer. I am currently cleaning it up and will post it anyways.
electrofux
Regular
Posts: 294
Joined: 24 Jan 2012 18:22

Re: How to sort an LED array backwards quickly?

Post 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?
oldgearguy
Regular
Posts: 315
Joined: 02 Nov 2013 11:19

Re: How to sort an LED array backwards quickly?

Post 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?
Post Reply