Activate/Deactivate more presets in one Preset/Translator

Hey,

 

have a question to make it a little bit easier as for every preset do a similar translator.

 

I wanna do this:

 

When I activate preset 1:

Preset 2-9 should be go on and parallel preset 10-19 should be go off.

When I activate preset 10:

Preset 1-9 should be go off and parallel preset 11-19 go on.

 

I know, that we could give all presets a global variable for example preset 1-9 get global variable gz and preset 10-19 hz. But how I can init them to it?

I couldn`t find out how I can init them to this.

 

Kindest regards

Mike

 

 

 

Hi Mike,

Try this.

I set the global variable ga as a bitmap for presets that need to be active. I'm using 20 bits out of 32 bits of ga

bit 0 is preset 0, bit 1 is preset 1 and so on.

So if you want preset 0 and 1 set you set ga to 3

For presets 0-9 the value is 1023 (0x3FF)

For presets 0 and 10-19 value is 1047553 (0xFFC01)

I use a timer ("Preset Change") to iterate through the bits and either turn off or on presets.

There are 2 translators that look at this timer.

The first one iterates through the global variable and activates a preset if the bit is 1. It ignores bits with 0.

The second one iterates through the global variable ga and deactivates a preset if the bit is 0. It ignores bits with 1. The second one also decrements the counter for both translators.

I use gc as a "counter" and also use that for the bit manipulation.

I set up incoming action with notes to demonstrate how it works Note 0 on MIDI CH 2 will activate 0-9 and deactivate 10-19. Note 1 on MIDI CH 2 will activate 0, 10-19 and deactiveate 1-9.

I also set up a translator on preset 1 so that when activated, it will trigger the preset change timer .

Likewise there is a translator on preset 10 that when activated will trigger the preset change timer.

So you can activated preset 1 and it will automatically set up the presets for 0-9 and deactivate 10-19.

If you activate preset 10, it will automatically activate 0, 10-19 and deactivate 1-9

 

I used a bitmap to reduce number of global variables needed but if you don't like the bitmap which can be confusing to some people, then you can hard code the logic in the rules

IE

if gc==1 then exit rules, skip outgoing action

if gc==2 then exit rules, skip outgoing action

...

 

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


Attachments:
1584716527089_Preset-Management-2020-03-20.bmtp

Amazing! Okey. Steve, I think Ive understand your way how did you use it. Of course some facts I couldnt find out. I have my problems to understand how works this things like:
qq=ga>>pp or pp=gc-1 what you say in the rules what happens here exactly.
Another point is, I´ve tried a small thing and changed the bits in other numbers and could see, that some presets go on and off. That should be mean, I only can use exactly the number you calculated. But did I have to know BOME Translator to calcute the exact numbers or give it a mastertemplate for it?
I would try to make an less complicated way like this:
If I give all first row presets a variable and all the second row presets another variable, if I activate the first row, all presets in this row activate automatic with this preset. If I activate the second preset, all of this row activate and deactivate the other row. Could be this happen too? Something like a workaround.

Ive tried out my way in mind and it runs perfect too! But not in this easy case like your way. Ive made on the first preset in the row more “Presets on activation” and say them similar and one for one, activate follwing presets…
Made a small preset changer like we did before but one thing I couldn`t figure out. I wanna tell him. After push for example “up arrow” go on preset of the row up. After push “down arrow” go one preset down. (I only mean the main presets (preset number 1 and number 10)
Something like a counter for only the main presets.

Hi Mike,

pp=gc-1 just takes the value of the global variable gc and subtracts 1 and assigns the answer to the local variable pp.

qq=ga>>pp

This is a bit shift operator. We take the value of ga and shift the bits right by the number of times in the value of pp and store the answer in the local variable qq.

For example, if ga has a value of 3 (binary 11) and we shift the bits right by 1, the new value is 1.

This is a common method of controlling bits (binary math) and very handy in MT Pro for reducing the amount of global variables if you only need to track 2 values (like on or off).

The best way to calculate what should be on and off, is to write out the binary and then use a binary to decimal calculator to determine the value you want.

So if you want preset 0 and 5 on and the rest on you would type

100001

in binary. In google type \"100001 in binary to decimal\" and you will get a value of 33. Sof if you want to set preset 0 and 5 only the proper value would be 33.

Binary values are from right to left worth 1,2,4,8,16,32,64,128.256,512,1024,2048

Basically very value to the left represents 2x the value of the preceding digit.

For 33, bit 0 is worth 1 and bit 5 is worth 32 so a total of 33 if you want to set bit 0 and 5.

I then use these bit values to determine whether to turn a preset on or off.

--------------

There IS an option to deactivate all othe presets (except always on) when activating a given preset. In your case it would not work since you want groups of presets activated. Of course you could still deactivate them all and then reactivate just the ones you want.

If you want to activate a preset based on row and say preset 1 and 9, then you can have a global variable that tracks the preset you are on and then activate it.

Say gb=1 and you want to switch between 1 and 9. You press down arrow and you have rules like this

Incoming Down

if gb==1 then pp=9

if gb==9 then pp=1

gb=pp

 

Activate preset gb

Then within each of these 2 presets activate the other presets you want either each with their own translator or using a repeating timer.

 

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

 
PS here are rules for use if you want to calculate the value of as set of presets.

// Enter presets you want to enable
// Comment those you do not
gb=0
pp=0
// Preset 0 - Comment next 2 lines if you do not want set
qq=1<<pp gb=qq // Do not comment the next line pp=pp+1 // Preset 1- Comment next 2 lines if you do not want set qq=1<<pp gb=qq|gb // Do not comment the next line pp=pp+1 // Preset 2- Comment next 2 lines if you do not want set qq=1<<pp gb=qq|gb // Do not comment the next line pp=pp+1 // Preset 3- Comment next 2 lines if you do not want set qq=1<<pp gb=qq|gb // Do not comment the next line pp=pp+1 // Preset 4- Comment next 2 lines if you do not want set qq=1<<pp gb=qq|gb // Do not comment the next line pp=pp+1 // Preset 5- Comment next 2 lines if you do not want set qq=1<<pp gb=qq|gb // Do not comment the next line pp=pp+1 // Preset 6- Comment next 2 lines if you do not want set qq=1<<pp gb=qq|gb // Do not comment the next line pp=pp+1 // Preset 7- Comment next 2 lines if you do not want set qq=1<<pp gb=qq|gb // Do not comment the next line pp=pp+1 // Preset 8- Comment next 2 lines if you do not want set qq=1<<pp gb=qq|gb // Do not comment the next line pp=pp+1 // Preset 9- Comment next 2 lines if you do not want set qq=1<<pp gb=qq|gb // Do not comment the next line pp=pp+1 // Preset 10- Comment next 2 lines if you do not want set qq=1<<pp gb=qq|gb // Do not comment the next line pp=pp+1 // Preset 11- Comment next 2 lines if you do not want set qq=1<<pp gb=qq|gb // Do not comment the next line pp=pp+1 // Preset 12- Comment next 2 lines if you do not want set qq=1<<pp gb=qq|gb // Do not comment the next line pp=pp+1 // Preset 13- Comment next 2 lines if you do not want set qq=1<<pp gb=qq|gb // Do not comment the next line pp=pp+1 // Preset 14- Comment next 2 lines if you do not want set qq=1<<pp gb=qq|gb // Do not comment the next line pp=pp+1 // Preset 15 - Commented so not enabled //qq=1<<pp // gb=qq|gb // Do not comment the next line pp=pp+1 // Preset 16- Comment next 2 lines if you do not want set qq=1<<pp gb=qq|gb // Do not comment the next line pp=pp+1 // Preset 17- Comment next 2 lines if you do not want set qq=1<<pp gb=qq|gb // Do not comment the next line pp=pp+1 // Preset 18- Comment next 2 lines if you do not want set qq=1<<pp gb=qq|gb // Do not comment the next line pp=pp+1 // Preset 19- Comment next 2 lines if you do not want set qq=1<<pp gb=qq|gb // Do not comment the next line pp=pp+1 // Preset 20- Comment next 2 lines if you do not want set qq=1<<pp gb=qq|gb

// gb should now be the bit map value you want

Thank you so much, for your detailed explaining of the commands Steve. Much appreciate sharing this with me =)
Ive searched in the internet to understand this complex calculating with Bits and Bytes. I have to say. The ground things are definitly enough for me. I mean, this detailed explaining is really awesome. I know because you helped me so much out, much things about MIDI and the software to handle awesome things. But I know, its only a small part from what you can make with it =)

Bit shifting is not complexi thing, but to understand whats happen with binary and hexa and convert it to the translator is the thing.

I will try your example near the time.

kindest regards and all the best to you

Mike

Hi,
Converting from binary to decimal is a pain but binary to hex is very easy if you put them in groups of 4.
Example 1111 1111 is hex FF. I usually enter the bits it hex format then MT Pro converts them automatically to decimal for me. If I put int 0x7F and come back later it will say 127

I always keep my Windows calculator handy. It has a mode that is called “programmer mode” which does conversion for you. There are also third part browser plugins that do conversion. IMO this type of caclulator is essential if you are doing bit mapping.

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

1 Like