Add MIDI foot-controller control; board/rig bypass; iOS fixes
Headline: MIDI control for a Behringer FCB1010 (four phases). - MIDIController (Lyrebird MIDI client): connection indicator via source polling, background-queue->main-actor hop, MIDI Learn. - Volume and Wah pedals (Wah reuses the SVF bandpass sweep, driven by pedal position instead of an envelope follower). - CC -> any pedal knob (0-127 mapped across the knob range). - Program Change -> pedal/board/rig toggles: software latch for booleans, exclusive radio for board solo. Positional addressing with display-name hints; stale/out-of-range bindings are skipped, not fired. - Per-rig MIDIMap embedded in ShoeGazeState as an optional field (old rigs decode to nil; no preset version bump). Central MIDI Mapping sheet with Learn/Clear per control. Also included (same working branch): - Full board bypass and rig bypass (dry passthrough via cascaded crossfades in BoardOutputMaster), with UI toggles. - Horizontal pedal picker grouped by category in filter order. - Drag a palette pedal onto a chain card to insert before it (ShoeGaze.insertPedal); tap still appends. - iOS: guard macOS-only .menuStyle(.borderlessButton) to silence the _UIReparentingView warning; iCloud-unavailable alert; keep the device awake while audio runs. Tests: 24 added (Volume/Wah, MIDIMap Codable incl. legacy decode, CC and PC controller behavior, insert/bypass API). Full suite green; macOS and iOS app targets build. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -18,8 +18,8 @@ import LyrebirdShoeGaze
|
||||
/// cached. Region segments are addressed by their index in `board.orderedSegments`.
|
||||
///
|
||||
/// Interaction:
|
||||
/// - Drag a palette pedal (`"add:<type>"`) onto a lane to append it there; tap a palette pedal to
|
||||
/// append to the main chain.
|
||||
/// - Drag a palette pedal (`"add:<type>"`) onto an existing card to insert it before that card, or
|
||||
/// onto empty lane space to append there; tap a palette pedal to append to the main chain.
|
||||
/// - Drag a card onto another card in the same lane to reorder; the corner trash removes it.
|
||||
/// - Connector lines render mono (single) or stereo (double) based on the running channel width.
|
||||
///
|
||||
@@ -393,7 +393,8 @@ public struct BoardFlowView: View {
|
||||
dropTarget = nil
|
||||
guard let payload: String = parse(items) else { return false }
|
||||
if let type: String = payload.afterPrefix("add:") {
|
||||
append(type: type, lane: .main)
|
||||
// Dropped a palette pedal ONTO a chain card → insert before that card.
|
||||
insert(type: type, at: ontoLinear, lane: .main)
|
||||
return true
|
||||
}
|
||||
if let src: Int = payload.afterPrefix("movemain:").flatMap(Int.init) {
|
||||
@@ -426,7 +427,8 @@ public struct BoardFlowView: View {
|
||||
return false
|
||||
}
|
||||
if let type: String = payload.afterPrefix("add:") {
|
||||
append(type: type, lane: lane)
|
||||
// Dropped a palette pedal ONTO a branch card → insert before that card.
|
||||
insert(type: type, at: ontoIndex, lane: lane)
|
||||
return true
|
||||
}
|
||||
// Reorder within the same lane: "movebranch:<region>:<side>:<index>".
|
||||
@@ -482,6 +484,12 @@ public struct BoardFlowView: View {
|
||||
catch { print("[BoardFlowView] appendPedal failed: \(error)") }
|
||||
}
|
||||
|
||||
private func insert(type: String, at index: Int, lane: PedalLane) {
|
||||
guard let board: PedalBoard = board else { return }
|
||||
do { _ = try shoeGaze.insertPedal(PedalType(type), at: index, to: board, lane: lane) }
|
||||
catch { print("[BoardFlowView] insertPedal failed: \(error)") }
|
||||
}
|
||||
|
||||
private func reorderMain(from source: Int, onto target: Int) {
|
||||
guard source != target, let board: PedalBoard = board else { return }
|
||||
// Convert "dropped ONTO the card at `target`" into movePedal's insert-before `toOffset`:
|
||||
|
||||
Reference in New Issue
Block a user