I have a midiplus keyboard with 6 assignable buttons, and I'd like to use them to perform various tasks on the interface. Specifically, I'd like one to switch engine 1 on and off, one to switch filter 1 on and off (and similarly for engine 2 and filter 2).
Mapping the buttons isn't a problem. But each button sends two midi signals: a 127 value when pressed and a 0 value when released. From what I can tell, the 127 sets the engine/filter to off, and the 0 sets it on again. So, if an engine is on, pressing the button turns it off until the button is released, at which point it comes on again. If an engine is off, pressing the button does nothing, but releasing it turns it on. There doesn't seem to be a way to make a button just change the status of the engine and leave it changed when released.
I don't think there's a fix for this outside Pigments itself, because there's nowhere in the keyboard or midi pipeline to keep track of the current engine on/off status. In Pigments itself, the fix would involve taking the 127 value and using it to toggle the engine from on to off, or vice-versa, and ignoring the 0 value.
I thought I'd start by asking here, to see if I'd missed something, or if anyone had a suggestion other than raising a feature request. Thanks.
[Edited to add: I got round this by writing an AppleScript in midipipe which, in effect, changed the buttons on my controller from gate mode to toggle mode. Script example in a reply below.]