Add per-binding CC invert toggle
Each CC binding gains an "Invert" toggle in the mapping sheet (shown once the control is bound). Inverting swaps the sweep — CC 0 drives the control to its max, 127 to its min — so a single expression pedal can crossfade two controls: map both to the same CC and invert one. The MIDICCBinding.inverted field and applyCC already honored inversion; this adds isCCInverted / setCCInverted plus the sheet toggle, and the binding label now notes "· inverted". Test: an inverted binding reverses the mapped output. 321 green; both app targets build. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -223,6 +223,12 @@ public struct MIDIMappingSheet: View {
|
||||
}
|
||||
Spacer()
|
||||
if binding != nil {
|
||||
Toggle("Invert", isOn: Binding(
|
||||
get: { controller.isCCInverted(for: row.target) },
|
||||
set: { controller.setCCInverted(for: row.target, $0) }
|
||||
))
|
||||
.toggleStyle(.button)
|
||||
.tint(.orange)
|
||||
Button("Clear") { controller.clearCCBinding(for: row.target) }
|
||||
.buttonStyle(.borderless)
|
||||
}
|
||||
@@ -243,6 +249,7 @@ public struct MIDIMappingSheet: View {
|
||||
if isArmed { return "Listening — move an expression pedal…" }
|
||||
guard let binding: MIDIMap.CCBinding = binding else { return "Unassigned" }
|
||||
let channelText: String = binding.channel.map { " · ch \($0 + 1)" } ?? ""
|
||||
return "CC \(binding.controller)\(channelText)"
|
||||
let invertText: String = binding.inverted ? " · inverted" : ""
|
||||
return "CC \(binding.controller)\(channelText)\(invertText)"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user