Is there some slick way to do this?

Discuss Lemur and share techniques.
Post Reply
mh175
Newbie
Posts: 23
Joined: 06 Oct 2012 16:42

Is there some slick way to do this?

Post by mh175 »

With one line of code? I'm tired of typing all this. I just want the value a to increment by one in my multipad object. Can't I specify a range for Pads.x and then tell a to find the position of the button press?

if (Pads.x[0])a=1;
if (Pads.x[1])a=2;
if (Pads.x[2])a=3;
if (Pads.x[3])a=4;
if (Pads.x[4])a=5;
if (Pads.x[5])a=6;
if (Pads.x[6])a=7;
if (Pads.x[7])a=8;
if (Pads.x[8])a=9;
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: Is there some slick way to do this?

Post by Macciza »

Hi
One way would be -
firstof(Pads.x)!=sizeof(Pads.x)?firstof(Pads.x)+1:0 //returns Pad.x +1 or ) if nothing pressed.
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]
mh175
Newbie
Posts: 23
Joined: 06 Oct 2012 16:42

Re: Is there some slick way to do this?

Post by mh175 »

Thank you!
Post Reply