general global variables on incoming action = midi

TabSel

2011-12-23 12:22:29

if incoming action = midi then
set general global variable "FS" := last "F"irst byte of triggering incoming midi &0xF0 (= Midi running "S"tatus)
set general global variable "FC" := last "F"irst byte of triggering incoming midi &0x0F (= Midi running "C"hannel)
endif

What I mean is:
whenever a translator in the project is triggered by an incoming midi byte sequence, the project global variables FS and FC are set according to the first byte of the triggering midi byte sequence.

Advantage:

- in the rules, you don't have to extract midi status and midi channel
("performance increase" in the rules, against "performance decrease" in BMT code; negligible, I guess)

- you don't have to use a local variable for that
(saves one local variable)

- in "non-midi"-incoming actions, you always have the information about the midi running status/channel of the last triggering midi byte sequence within the whole project!
(saves up to two global variables and coding work to maintain this functionality manually)

- you don't have to extract status/channel in each and every rule!!!
(less typing the same over and over again, less code, better code maintenance)

- easy to implement for you, fully backwards compatible to existing projects etc...

would be few keystrokes for you, saving your customers millions and millions of keystrokes ;)

florian

2012-01-24 19:10:23

Hi TabSel,

thanks for the proposal. In general, such a concept could make it into a next version of MT, but more generalized. Because as MT is used for so many different things, just the status and the channel will not be generally useful. Then I'd rather also define global variables for "data 1" and "data 2".

However, this has to wait for version 2, where we'll introduce freely nameable variables and "functions", i.e. special built-in variables. Then we should add such special variables to access the current (or most recent?) MIDI message. Right now, the variable name space is more or less fully taken...

Thanks again!
Florian

florian

2012-01-24 20:32:42

oh one thing to add: of course you can emulate this relatively easy:
just insert a preset right at the beginning (i.e. the first preset). It contains one translator:

Code: Select all

INCOMING: MIDI pp rr tt
Rules:
 gc = pp & 0x0F
 gs = pp & 0xF0
 g1 = rr
 g2 = tt
OUTGOING: (none)
Now wherever you're processing an event, you can access gc as the channel, gs as the MIDI status, g1 as data1, and g2 as data2 from the last most recent MIDI event.

Best,
Florian