High Bitmapping

Hey Steve,

 

have a question to the current project from me. (Channel-Switch-Takeover)

I got from you the example for 1 column with the mask of bits.

I wanted to ask you, how you get this following maps to make for all 33 CC`s?

Example you see here, what I mean is written in bold: Give it a special calculator for this?

Label "done" // mask lower 1FFF80 rr=127<<0 rr=rr^-1 gz=gz&rr //gz=gz&2097024 gz=gz|qq // Put back into proper permanent global variable g0=gz

and the other point:

If I go from Channel 1 to Channel 2, I see the change from rr to ss. Can I go backwards to oo, mm, nn etc, because the 16 different channel changes?

 

Thank you

 

Kind regards

Mike

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

Wow! Thank you for your detailed answer. Now I’ve understand much more about this rules and bitmapping.

Got some info tasks from your rule description, which was very helpful to me, too. But some of them i couldn’t understand or come to logical result.

I could find out, that I’ve done much of your explaining right. I’ve done, all the 16 channels, with every changed value of g0-gf till n0-nf and did all the lights on/off for 16 channels and some other things. That’s amazing news for me, after reading your explains about this.

Thank you. 🙂

But now, I couldn’t understand how you build this one “1FFF80” Maybe you could make another example with this? After looked at the other channel, couldn’t find a result, how did you do this. Maybe I couldn’t understand this part what you mean:

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 (so we don’t write 0 after shift here?) , second knob – shift 7, third knob shift 14 and fader shift 12 (I think you meant shift 21, or why shift 12?

We have 8 columns, if I see every letter (a, b, c, d) has 7 bits. So 1 bit is lose in every column?

For channel 1 first column it is g0=gz

For second column it would be h0=ga

Would be the third column i0=gb?

And the fourth column j0=gc?

The first part I’ve done was right. The other with gb, gc, gd, ge etc. I’m not sure.

 

gz=gz&rr //gz=gz&2097024

The numbers are a fantasy number of 7 bits? So could I write on the

channel 3 //gz=gz&3057092

And channel 4 //gz=gz&4097803

For example? Or have to be a special number on it?

Kindest regards

Mike

Yes third one is 21 not 12. Typo.
Don’t pay attaention to the comments gz=gz&xxxxx.
This is how I hard coded it and it was too difficult to figure the right number. That is why I changed verything to bit shift operators, so I wouldn’t have to do the math.

gz is used across all channels as a temporary global.
When you activate a preset for a given channel. There is a rule that takes the global variable for that channel and moves it into gz. That way we work all within gz for all channels and just put it back at the end of the translator

Activate channel 1
gz=g0 – first column
hz=h0 – second column
iz=i0
jz=j0
kz=k0
lz=l0
mz=m0 8th column
nz=n0
yz=y0 master fader

end of knob translator column 1
g0=gz
end of knob translator column 2
h0=hz
Activate channel 2
gz=g1

end of translators
g1=gz
knob 2 channel

The whole idea is to always put everything in gn-nz and yz when you activate your preset and then depending on which knob you are moving, put it back when you are done with the knob

column 1 knobs always start with g
column 2 knobs with h

channel 1 knobs always end with 0
channel 2 knobs always end with 1

temporary storage for all channels as you activate them is _z gz,hz,iz – depending on the column.

This allows you to do less editing with rules when duplicating translators.

Forgot to tell you about gz-yz however which has to be changed in rules when you change columns

Steve Caldwell
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
bome@sniz.biz
PS if you convert the numbers in comments to binary you should see the pattern.

Hey,

okey. Thank you for solve some open questions 🙂

 

Now I have another question, I think I have done something wrong….

I have took every “vv” on from top to botton, took all variables on the right position I think.

 

On channel 1 -3 and 4 on this project attached, my knobs are very hard and get a reaction after coming on the right saved last value.

Channel 2 does it very clean. Why the other 3 channels don`t do this too?

Can`t see a difference between the channel rules….

I have checked my init Rules, nothing looks to be wrong.

 

kind regards

Mike


Attachments:
1571395368644_Multi-Channel-Takeover.bmtp

You are putting back gz into the wrong variable at the end of each of your knob/fader move translators so the wrong global variable is retaining their last known value. This is even true for everything but column 1 in channel 1 and channel 2 (which I did)

For instance channel 1 knob column 2 knobs should say at the end.

h0=hz

Since you are storing to the wrong permanent variable, the takeup will not know the knob’s last known state.

Steve Caldwell
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
bome@sniz.biz

I am only on column 1 with all 4 channels.
The other columns and channels aren`t done till now.

To understand what happens detailed there.
At the end I have done:

Column 1 Channel 1 : g0=gz
Column 1 Channel 2 : g1=gz
Column 1 Channel 3 : g2=gz
Column 1 Channel 4 : g3=gz

But reaction is hard at some knobs again. A small thing is there not correct in my project and can`t find it out.

kind regards
Mike

On Column 1 Channel 3 in the file you sent it says g0=gz where it should say g2=gz as you indicated above.

That I have correct as well didn’t run clean again.
Did I have to change this variable on another place too?
Normally how I have understand your explain, should be everything run normally and clean, with only change the end of the rule of every knob/fader.
The vv variable in the bit shifter and that’s all or have it forgot something?

Should I delete the last rule lines with the 7bit form maybe?
After “label done” and only let stay the last variable rule? G0=gz and so on?

In 5.2 you have

rr=gz>>8
rr=rr&127

which should be
rr=gz>>7
rr=rr&127

second row should aways be 7
third row 14
and fader 21

To find this stuff out, you need to turn on your log and look at rules executing to see the logic and also maybe do dump Vars once it a while. This is the standard process for troubleshooting. Also make sure any translators that you have not yet finished are disabled otherwise you might unknowingly introduce other errors.

Ah Okey. I thought I should do for every knob and fader one unique vv= variable for one channel.
Because I had to go from vv=0 till vv=32
So for example :
Column 1 Knob 1 Channel 1 : vv=0
Column 1 Knob 2 Channel 1 : vv=1
Column 1 Knob 3 Channel 1 : vv=2
Column 1 Fader 1 Channel 1 : vv=3
Column 2 Knob 1 Channel 1 : vv=4
and so on.

That has confused me I think.
I look if I understand the error messages on the log monitor.

vv handles the bitmap for knobs that have changed since you switched channels which always uses the global variable zz (all ones are set when you switch MIDI channesl)

The other is a bit map for the position of the current knob or fader value in the current global variable
0, 7, 14 or 21
g_ h_ i_ … where _ is channel and g h i are column

So we are bitmapping knobs with 7 bit nibbles and validation flags with a single 32 bit variable.

I have now edited everything. But one thing is still the same problem. At some knobs, they react first after reaching the 50% and react only from this value.
Example:
Knob 1 Channel 1 – Value 70
Knob 1 Channel 3 – Value 100

Knob 1 in Channel 1 – Reacts first on reach value 63
Same thing at other knobs. They react first on reaching value 63 (50%)

Maybe you need the current edited project for it.

Thanks a lot


Attachments:
1571475510304_Multi-Channel-Takeover-Edit.bmtp

Hi Mike,

Welcome to the world of troubleshooting... Without looking at your project, it appears that for some knobs you are either not returning the value back to the proper global variable when finished, or that you have the bit shift logic wrong on some of them meaning the values are crossing the 7 bit boundaries of a global variable.

I say this because at project start, all knobs are set to 50% and faders to 0% as part of the “Initialize Global Variables” translator. So if you are returning to 50% after switching channels, it is because that knob’s global variable was not properly updated.

So please have a look at your log file after shifting channels to see if the global variable is properly set after switching channels by clicking “Dump Vars” in the Log Window or turn on rules logging and turn the knob so that you can see what is happening.

My main role here is to coach users so that they can start implementing their ideas and requirements on their own. This is voluntary support from Bome, with the goal to get everyone started. For simple projects, I can usually provide full solutions, but the more complicated it gets, the more I'll just go by example to show the approach.

Now is a good time to roll up you sleeves and become more independent if you want to write your own projects :)</p?

On the other hand, you may know that I am offering paid services for expanded scope of support, like advanced and full implementations, testing, troubleshooting, and so on. In that case, just drop me a private email, and I will provide you an estimate.

Steve Caldwell
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
bome@sniz.biz

Hey Steve,

Thanks to let me know what your quest here is. Now I understand you. I wanna thank you so much, for take your time and help me out.

I found my big mistake. You are right. I have forgotten to change the very last command in the rules. I have to say, that I really didn`t see everything so fast. But I am here to learn about this material.
Now everything runs perfect!
Thank you so much for helping me out with this good tool. Now I can do the things I need.
I will be write you an email, if will be needed. But for now, I think I have resolved this problem. I have tested the very new edited version on 4 Channels and every channel runs perfect.

All the best
Kindest regards
Mike

My pleasure, Mike. Glad that I could help get you kickstarted.

Steve Caldwell
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
bome@sniz.biz