Greetings! I stumbled on this post as I was trying to make some MIDI bindings with a modifier key. Unfortunately OP never got back to posting about this one, and the files he kindly posted don’t reveal much since I don’t have the objects he’s calling.
But I poked around with this idea, and came up with a pretty workable solution. First I’ll talk generalities.
So, my solution was basically to take a given MIDI input source and run it through a rack that sits inbetween the origin input and where I want it to go. Sitting in this rack is a MIDI route that basically passes things unchanged, and another MIDI route that maps one MIDI channel to another. The first route is on, and the second is disabled. Then, in this rack, I bind one particular button from the midi controller to momentary toggle both routes.
You then only have to make sure that the bindings 1) listen to the output from that rack instead of directly from the midi controller and 2) listen to specific channels instead of omni.
OK, specifics time!
In my case, I used an Akai MIDIMix. This is a pretty powerful, inexpensive little controller - but it has a couple quirks. Still, I’ve found it very useful and highly recommended if you are ok getting your hands dirty. It’s quirks are gonna throw a couple wrenches in our plan. You can read more about it’s inner workings at the doc linked below.*
So, I wanted to use the various buttons (intended for Rec and Mute) to call up patches in a setlist, since my band does not do actual planned setlists. However, I wanted to be able to call up more than 16 different songs quickly, so I wanted essentially a “second layer,” bringing my total to 32. Conveniently, the Solo button already does something similar. Without this button pressed, the “mute” buttons send a note on channel 1 - WITH this button held down, the “mute” buttons now send the same note on channel 2. But, unfortunately, it does not effect the “rec arm” buttons. That’s where the rack comes into play.
So, in my case, I wanted all this in the background rack. So within the background rack, I made another rack that I pointed the MIDIMix to.
Inside that rack is one route that just patches the input to the output, and a second that does whatever modifications you want your “modifier” button to do. Bind enabling of both of these routes to the modifier button, and invert them. Making the binding momentary will vary depending on how your midi switch works. Since mine sends “note on” on press and “note off” on release, I used the “Note (Switch)” event type.
Now when you make your bindings, have the source be the output of that rack. In my case, since the hardware itself modifies the top row of buttons, anything from MIDI channel 1 I could leave unchanged. I’ll probably make them listen to the rack instead of the midi controller eventually, just for consistency sake. But for now it’s fine.