Another good one!
Longpress, yes. I've long thought about adding something like that for my own purposes. Footswitch-Chords, maybe. Simultaneous, asynchronous event handling can be somewhat harry, and specification gets sticky too. But it does allow for a few footswitches to go a long way, so it's worth considering.
Also considering these:
- MIDI Program Change messages
- toggle between midi-CC values other than the default 0 and 127
- multiple midi msgs per click (CC61 + CC62)
To be most flexible, any action (CC, PC, bypass, preset, etc.) could be triggered by any event (click, longpress or chord). So I'm thinking additional yaml levels might be needed.
footswitches:
- id: 0
debounce_input: 0
on_click:
# toggle CC60 between 45 and 46 (instead of the default 0 and 127)
midi_CC:
CC: 60
value_off: 45
value_on: 46
preset: UP
on_longpress:
bypass: LEFT
- id: 1
debounce_input: 1
on_click:
midi_PC: 4
on_longpress:
# multiple CC's, same press, toggle between default 0 and 127
- midi_CC: 61
- midi_CC: 62
# For backward compatibility, still need to support this which assumes the click event
- id: 2
debounce_input: 2
midi_CC: 70
bypass: LEFT
preset: DOWN
The syntax/indention is more finicky, and backward compatibility somewhat trickier, but probably best to define it broadly now instead of bolting on one use case at a time. I suppose adding "on_click" maybe isn't needed if backward compatibility already assumes on-click, but it does make things more symmetrical when on_longpress is added.
I understand your intent behind the chord definition (eg. 2+3) but I'm not so fond of there being footswitch objects which are more like virtual footswitches. The count doesn't match the number of physical footswitches. I'd be more likely to create a new object type. But again, chords make a lot of code a lot more complex. Would require some deep thought, code analysis and trials.
Would the above allow you to do most of what you're wanting to do?