Accessing 288 variables across 4 Controllers

DvlsAdvct

2013-10-24 18:07:58

An email was received from a user:
I'm currently working on a project with 4 Launchpads, using 4x72=288
buttons.
The long winded way is to have 288 presets with 288 globals.
On your website I found a project which calculates the button pressed
on a Launchpad.
I have tried to use this technique, but I can't see a way to add a
toggle facility.
I have attached a file of my attempt at the button calculation, but
can't find a way to implement a toggle for the 288 buttons without 288
Globals.

I would welcome your thoughts on this.

DvlsAdvct

2013-10-24 18:52:49

So there isn't an easy way to pull all of these variables, unfortunately. We can, though, minimize translators as well as presets. For this to work you should only need to use 4 Presets, though you could use 2 per controller: one to go to your application as a passthrough and one to go back to the Launchpad to calculate all LED toggle functions.

We want to avoid having 72 translators per preset, and we want to avoid having hundreds of lines of rules to fit this in one translator for output. I think the sweet spot would be to organize each preset into 9 translators to handle the variable storage. This way it simplifies the projects a little, but still allows us to organize all of the variables together and handle everything in a clean fashion.

Since you are not changing the messages being sent out to your application, this can work as a passthrough. You can route these in the MIDI Router or use a simple translator passing through from each Launchpad into your application. For the LED toggles, though, we can break these out into 1 translator for each row (since they are sequential by row) and route the incoming signal to specific global variables which will then toggle on or off based on their previous state. To do this we are going to use a combination of Labels in your rules. There are a lot of rules we need to add, but I can't think of a way to mathematically pull global variables using MT. If anyone has a more efficient way to pull this information please add it below.

Code: Select all

Translator 1: Button Passthrough
Incoming Message: 90 pp 7F
Outgoing Message: 90 pp 7F

[i]This will just pass the signal out from your Launchpad straight to your application.  You can also do this with the MIDI Router[/i]

Translator 2: Row 1
Incoming Message: 90 pp 7F
Rules: if pp>8 then exit rules, skip Outgoing Action
if pp==0 then Goto "0"
if pp==1 then Goto "1"
Label "0"
ga=ga+1
if ga>1 then ga=0
if ga==1 then qq=127
if ga==0 then qq=0
exit rules, execute Outgoing Action
Label "1"
gb=gb+1
if gb>1 then gb=0
if gb==1 then qq=127
if gb==0 then qq=0
exit rules, execute Outgoing Action
etc...
Outgoing message: 90 pp qq
So you'd need one of those for each row, and you'd use 72 variables per Launchpad, leaving enough room to use all of the global variables. I know it's still a lot of work, but I'm struggling to figure out how to use a combination of local and global variables to quickly assign global variables to a command without a lot more math. That being said, you'd only need 4 presets, one for each translator. Let me know if this helps.

Thanks
J