Hi, let me try to explain what is happening here
Label “done”
// mask lower 1FFF80
Label “done”
// mask lower 1FFF80
The below takes the byte value for the knob and shifts it into the correct position
We are using 7 bit values and stuffing a single global variable with the value of the knob
Bits 0-6 are the top knob (a) , 7-13 the second (b) knob 14-20 the third knob (c) and 21-28 the fader (d).
So for top knob there is no shift, second knob – shift 7, third knob shift 14, and fader shift 12
dddd dddc cccc ccbb bbbb baaa aaaa
We can use the same local variable (rr) for each translator because when we are done, we will put everything
into the global value
// Shift bits
rr=127<<0
// Complement
The below makes all 0’s 1 and all 1’s 0. In MT Pro terms we use 32 bit signed values so -1 is represented
in binary as 1111 1111 1111 1111 1111 1111 1111 1111
rr=rr^-1
// Clear existing nibble
Now we and with rr and put into the global variable, essentially clearing that 7 bit nibble
gz=gz&rr
//gz=gz&2097024
// Now we take the incoming value of the knob and OR it with the global variable to stuff it in place
gz=gz|qq
// Put back into proper permanent global variable
We used a temporary global variable for each channel and when we activated the preset we did gz=g0
The below puts the temporary global variable in the permanent global variable.
I use a temporary gloval variable for each channel so I can make the translators more generic in every
channel.
g0=gz
So the only things that need to change in the rules here is the bit shift for the knob depending on the position
and the last rule which puts everything back into permanents storage and the value of vv (which is explained later)
For channel 1 first column it is
g0=gz
For second column it would be
h0=ga
the colums i,j,k,l,m,n
channels are 1-f
so first column channel 1 is g0.
First column channel 2 would be g1
First column channel 3 would be g2
For second column channel 2 we would use h1
Second column channel 3 would be h2
so g-n =column
and 0=f = MIDI channel
Then for the master fader we break the rules and use y0-yf
The rules on the other knobs are a bit different. I had to create another temporary value ss but otherwise, things are the same.
So basically you need to modify the the bit shift and then the final value to stuff back into permanent storage.
Then for zz, that is a 32 bit bit-map that tells you what fader are invalid for that channel.
A bit being a 1 is invalid and set any time you change channels.
When the fader value is equal to last known value, you set it back to 0
So at the beginning of each translator you will need to put
vv=0
to vv=32 to make sure you are clearing the right bit.
You will need to create a new variable for the master fader since there are only 32 bits and 33 controls.
The first four lines determine if the bit is cleared.
// Check for channel switch
// bit position
vv=1
tt=zz>>vv
tt=tt&1
if tt==0 then Goto “done”
Later when the current value matches the incoming value you clear that bit.
// Now look to see if we have crossed the last point
// clear the channel switch flag (enable output)
if rr==qq then tt=1<<vv
if rr==qq then tt=tt^-1
if rr==qq then zz=zz&tt
if rr!=qq then exit rules, skip Outgoing Action
If you see uu=0 you can safely remove that line as it is a remnant from past version.
Steve Caldwell
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
bome@sniz.biz