Running out of global variables!

Now that I’ve 256 separate encoders that can light up on my APC40, I’m thinking about holding global variables for each state. Now i know thats a hell of a lot of global vars being used up immediately.

Is it possible to take the 7bit value of pot 1 and tag the 7 bit value of pot 2 to the end of it and split them when the relevant channel is accessed again to feed directly to the APC?

My math skills and operand etc are non existent unfortunately.

Or (i think this is how it works anyway) could a pitch bend contain a positive and negative value for ear value? If the pitch down was at -127 and up was at 63 for example, is there a way for those values to transfer to pot 1 == +127 and pot 2 == 63 ?

Cheers again,

Tony

Hi,
Thanks for posting!

The attached example shows how you can capture and store 4 7 bit CC’s into a single global variable.
I exclude the high (unused) bit of each 8 bit character. In this example I’m using ga and I store cc32 into the lowest byte, cc33 in to the next higher byte, cc34 into the next higher byte and cc35 into the highest byte.

I use a combination of bit shift operations, AND and OR operations to manipulate the bits.

The excerpt below if from the third knob. For the second knob the shift is 8 and the 4th knob is 24

pp=ga
// Shift mask into position
rr=255<<16

//zero existing
// reverse all bits ( -1 is all bits set ) Doing an exclusive OR with all bit sets reverses the bits
rr=rr^-1
// and with existing to clear them
pp=pp&rr

// shift new value into position
qq=qq<<16
// or it with old value
pp=pp|qq
// put it back
ga=pp

Here is the project file.

Store-4-into-1-global-variable.bmtp (2.7 KB)

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz
1 Like

Oh and pitch bend is just a 14 bit value between 0 and 16383 (which consumes 14 bits).

1 Like

Oh and finally version 1.9.0 allows for an additional 350 global variables.

Where only pp used to be use for locals now you have

oa-oz and oo-o9 (excluding oo) that is global
pa-pz and p0-p9 (excluding pp) that is global
same for variables beginning with q,r,s,t,u,v,w and x

1 Like

Thanks Steve,

I’ll take a good look at these whilst sober!

Good idea. If not sober, your head will likely explode. :wink:

1 Like

It’s getting to that point already … I do like a good rum.

I need all the brain cells I can keep.

i am a bit confused.
in Version 1.9 you still have the global Variables z0-z9, right ?
because I used then in a project and they defiantly work,
but when I dump variables in Log-Window they are not shown !

can somebody explain this ?

Hi, yes z0-z9 is still available, however any global variables that have a value of zero will not be shown. Can you set their values in a translator to other than zero and then try to dump them again?

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

i made sure that they have a value above zero
but they are not shown in the dumplist.
I opened the same project in version 1.8.4 and there they are shown.

I’m able to duplicate the problem and we are working on a solution. Thanks for reporting it! In the mean time, I found that x0-x9 and y0-y9 work if these are available to you.

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz