Let one footswitch drive multiple toggles (scenes)

captureSwitch stole a Program Change from any prior action, so one footswitch
could only drive one toggle. applyProgram already fires every matching binding,
so this just drops the steal-by-program: one binding per action (re-learning an
action replaces it), and a single PC may drive MANY actions — a "scene" (e.g.
bypass two pedals, or solo a board and bypass another, from one press). Mirrors
the CC multi-target change.

Tests: one PC drives two actions and toggles both; re-learning an action
replaces its program. 323 green; both app targets build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-01 13:45:13 -07:00
parent e25b75a880
commit 48ac573489
2 changed files with 33 additions and 7 deletions
@@ -309,8 +309,10 @@ public final class MIDIController {
displayNameHint: hint(for: action)
)
var map: MIDIMap = shoeGaze.midiMap ?? MIDIMap.empty
// One action → one program, and reassigning a program steals it from any other action.
map.switches.removeAll { $0.action == action || $0.program == program }
// One binding per action — re-learning an action replaces its binding. A single footswitch
// (program) may drive MULTIPLE actions on purpose (a "scene": e.g. bypass two pedals, or
// solo a board and bypass another, from one press), so we do NOT steal by program number.
map.switches.removeAll { $0.action == action }
map.switches.append(binding)
shoeGaze.midiMap = map
onMapChanged?()