General

ctlout syntax for pad array?

Started by whatisvalis on .

Sign in or create an account to join the conversation.

6 posts

Topic starter
I can't get this working. I'm try to set the CC values for a pad array using ctlout

i've tried this, but no luck.

ctlout(1,{16, 17, 18, 19, 20, 21, 22, 23, 24, 25},127,1);

Basically on certain conditions i want the array to send out different values, unfortunately it's stuck sending out the first value.

I could use a custom midi script, but i do not know how to switch between different custom scipts
Is there a more efficient way than this?

if(x[0])
ctlout(1,16,127,1);
if(x[1])
ctlout(1,17,127,1);
if(x[2])
ctlout(1,18,127,1);
if(x[3])
ctlout(1,19,127,1);
if(x[4])
ctlout(1,20,127,1);
if(x[5])
ctlout(1,21,127,1);
if(x[6])
ctlout(1,22,127,1);
if(x[7])
ctlout(1,23,127,1);
if(x[8])
ctlout(1,24,127,1);
if(x[9])
ctlout(1,25,127,1);
as soon you have a mathematical 'row' (don't know the exact term in English, numbers that follow a simple rule like +1), you can use ++ (increment) and -- (decrement). Should be something like this:
decl i;
for (i=0; i<9; i++);

if(x[i])
ctlout(1,i+16,127,1);
I haven't tested it, tell me if it works.
there was an error, it should be
decl i;
for (i=0; i<=9; i++);

if(x[i])
ctlout(1,i+16,127,1);
but maybe you'll need two variables.

I got this from a user library template, I actually never used incremental arithmetic operators myself. Unfortunately I only noted that syntax, not the name of the template. But I think it's close to the solution.

Edit: hmm, thinking about it, there must be a firstof() function in the script, like in the Ambivalent Beats template. The Lemurised L3 template from the AB Bundle could also give a hint, but my editor crashes everytime I try to load it.
That ended-up out putting on 26 only.

I've experimented with firstof, but really guess work to be honest. Maybe the ctlout function is limited in that respect?

I thought Ambient Beats was mostly Max 4 Live back-end stuff? I'll have a look anyway, I've been trawling the library for ctlout examples

cheers Phil.

JD