Button's id and CC number

I think i'll need tons of buttons... tons... and this time, no matrix...

So, let's say i want :

  • Button_0 with preArgs : [1,0]
  • Button_1 with preArgs : [1,1]
  • Button_2 with preArgs : [1,2]
    and so on and so on...

No problem if i just set a number as button's id.

With ids like "Button_number", i can use a script widget and linkID :

if (value === 0) return
for(var i = 0; i < 50 ; i++)
{var ID = 'Button_'+i
if(ID == id) send('midi:SEL','/control',1,i,1)}

So two questions :

  • is there another way to do this, without script ? Just a precise typo in the preArgs field ?
  • how to use here kinda button.length to set a limit to i ? as i don't know how many button's i'll use...

Thank you

Not quite sure what you are trying to achieve but you can use an OSC listener on the preArgs field so you can use the custom module to define how the button works.

You could extract the number directly from the id

if (id.includes('Button_')) {
  var i = id.split('_')[1]
  console.log(`button ${i} pressed`)
}

Or, instead of using the id, use the button's on property to indicate the cc number, that's the value that will be sent to the script:

var id = value
// etc

On a sidenote:

if (value === 0) return

can be avoided if use tap buttons (mode property).

1 Like

@jean-emmanuel : Right, I had the split option somewhere in my head, as we used it in the "ultimate cubase custom module". Now, i remember :metal: Thank you.

@Sub3OneDay : thank you. I was thinking, last night, instead of sleeping (...), about using OSC listener, as i have some examples in mind (@gcat custom module, and one mcu CM too i've seen around here). And actually, as i watched the youtube video introducing Flow+, i was thinking... "hey... kinda rebuilding my template in o-s-c could be sooooo... cool-but-no-so-usefull-so-absolutely-necessary..". So... i started this long long journey... One PLE track selection preset, for each track, on a side... one related button in o-s-c... folders buttons... Gosh... that's it... i went absolutely crazy... Drowned into the One-more-button river :crazy_face:

O-S-C is just sooo addictive...

This is similar to how I do it. Then it is easier to change things globally like the midi target by using the custom module.

If you give all your buttons a consistent address like /btnCubaseCommands you can filter these in the custom module and send a cc based on their value.

I'll give a try on filtering out with custom module. I have'nt been there yet !

For now, i found another solution, i use an array for CC numbers in my script widget:

var CCs = [];
for(let x = 0;x<128;x++)
{CCs.push(x);}

// BASSES
for(var i = 0;i<5;i++)
{
setVar('a'+i,'la',Lab_Basses[i]);
setVar('a'+i,'pre_ch1',[1,CCs[i]]);
}

select

1 Like