Bit manipulation is the bomb! I mean Bome. I was inspired to dive in and try BMT by these posts on bit manipulation, which is incredibly powerful. At first I couldn't understand why translators don't just automatically extract the channel number from the status byte because it is a very useful parameter. Thinking about it -- and the fact that the good Herr Bome has given us bit operators -- I propose the following "sandbox" example which rechannelizes any 2- or 3-byte message from any channel to a desired new channel:
Code: Select all
\\ translator 0 - set desired channel using an arbitrary sysx command
Trigger: F0 01 02 03 g0 F7
Outgoing: None
\\ translator 1 - rechannel incoming 3-byte messages to channel g0
Trigger: pp qq rr
Rules:
pp=pp&240 \\ use binary 11110000 to mask out the four least significant bits
pp=pp+g0 \\ add back the desired channel
Outgoing: pp qq rr \\ and that's all there is to it!
\\ translator 2 - same again for 2-byte messages
Trigger: pp qq
Rules:
pp=pp&240 \\ use binary 11110000 to mask out the four least significant bits
pp=pp+g0 \\ add back the desired channel
Outgoing: pp qq
The alternative would have been a lot of if statements or a lot of translators.
I can hardly wait for release 2.0! And I apologize to the group if, noob that I am, I seem to be discovering the obvious. But it seems cool to me.