Address review; make all pedal controls (incl. sliders) CC-mappable
Review fixes: - Remove stale phase-plan references from MIDIController / MIDIMappingSheet doc-comments (describe current behavior instead). - insertPedal: a board with no linear pedals but a trailing routing region now inserts at the head (before the region) instead of appending after it. - Drop the unused MIDIController.retarget (the app recreates the controller against a fresh engine rather than re-pointing it). - CC steal now matches controller AND channel, so per-channel CC bindings can coexist. Feature (requested): CC mapping now covers every continuous pedal control, not just rotary knobs. New PedalControl descriptor + Pedal.ccMappableControls (knobs followed by effect sliders); the Expression sheet lists them grouped per pedal with a header, so slider params (e.g. EQ bands) are assignable and labelled clearly. Knob-first ordering keeps existing CC bindings stable. Tests: +2 (CC drives a slider control; insert into a region-only board lands before the region). 318 total green; both app targets build. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -12,8 +12,9 @@ import LyrebirdUI
|
||||
/// pedal knobs via MIDI Learn.
|
||||
///
|
||||
/// Presented from the transport-row ``MIDIIndicatorView``. Rows are generated by walking the live
|
||||
/// `ShoeGaze.boards` / `board.pedals` / `pedal.knobs`, so bindings address controls positionally.
|
||||
/// (The Program-Change switch section is added in a later phase.)
|
||||
/// `ShoeGaze.boards` / `board.pedals` and each pedal's controls, so bindings address controls
|
||||
/// positionally. A Switches section binds Program Change to toggle actions; an Expression section
|
||||
/// binds Control Change to continuous pedal controls.
|
||||
public struct MIDIMappingSheet: View {
|
||||
|
||||
// MARK: - Constants
|
||||
@@ -145,21 +146,29 @@ public struct MIDIMappingSheet: View {
|
||||
let boardIndex: Int = boardPair.offset
|
||||
let board: PedalBoard = boardPair.element
|
||||
ForEach(Array(board.pedals.enumerated()), id: \.offset) { pedalPair in
|
||||
pedalRows(boardIndex: boardIndex, pedalIndex: pedalPair.offset, pedal: pedalPair.element)
|
||||
pedalRows(
|
||||
boardIndex: boardIndex,
|
||||
pedalIndex: pedalPair.offset,
|
||||
pedal: pedalPair.element,
|
||||
boardLabel: board.label
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func pedalRows(boardIndex: Int, pedalIndex: Int, pedal: Pedal) -> some View {
|
||||
ForEach(Array(pedal.knobs.enumerated()), id: \.offset) { knobPair in
|
||||
private func pedalRows(boardIndex: Int, pedalIndex: Int, pedal: Pedal, boardLabel: String) -> some View {
|
||||
// Per-pedal header so each control row can show just its own name.
|
||||
Text("\(boardLabel) · \(pedal.displayName)")
|
||||
.font(.subheadline.weight(.semibold))
|
||||
.foregroundStyle(.secondary)
|
||||
ForEach(Array(pedal.ccMappableControls.enumerated()), id: \.offset) { controlPair in
|
||||
knobRow(
|
||||
boardIndex: boardIndex,
|
||||
pedalIndex: pedalIndex,
|
||||
knobIndex: knobPair.offset,
|
||||
pedalName: pedal.displayName,
|
||||
knobLabel: knobPair.element.label
|
||||
knobIndex: controlPair.offset,
|
||||
controlLabel: controlPair.element.label
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -168,8 +177,7 @@ public struct MIDIMappingSheet: View {
|
||||
boardIndex: Int,
|
||||
pedalIndex: Int,
|
||||
knobIndex: Int,
|
||||
pedalName: String,
|
||||
knobLabel: String
|
||||
controlLabel: String
|
||||
) -> some View {
|
||||
let isArmed: Bool = controller.learnTarget == .cc(
|
||||
boardIndex: boardIndex, pedalIndex: pedalIndex, knobIndex: knobIndex
|
||||
@@ -179,7 +187,7 @@ public struct MIDIMappingSheet: View {
|
||||
)
|
||||
return HStack {
|
||||
VStack(alignment: .leading, spacing: 1) {
|
||||
Text("\(pedalName) · \(knobLabel)")
|
||||
Text(controlLabel)
|
||||
Text(bindingLabel(isArmed: isArmed, binding: binding))
|
||||
.font(.caption)
|
||||
.foregroundStyle(isArmed ? Color.orange : .secondary)
|
||||
|
||||
Reference in New Issue
Block a user