Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b55df174a6 | |||
| f87fc1d4b1 |
+10
@@ -1,5 +1,15 @@
|
|||||||
# Releases
|
# Releases
|
||||||
|
|
||||||
|
## 1.1.1 — 2026-06-26
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
- Pedal **ⓘ info button** moved to the top-left corner (under the corner screw),
|
||||||
|
out of the way of the name plate.
|
||||||
|
- Fixed **dragging a pedal into a Stereo Unzip / Split / Parallel lane**. Dropping a pedal
|
||||||
|
from the main chain (or another lane) into a region lane now moves it there, preserving its
|
||||||
|
parameters — previously the drop was silently ignored. Empty lanes are also fully
|
||||||
|
hit-testable now.
|
||||||
|
|
||||||
## 1.1.0 — 2026-06-24
|
## 1.1.0 — 2026-06-24
|
||||||
|
|
||||||
### New pedals
|
### New pedals
|
||||||
|
|||||||
@@ -117,6 +117,83 @@ extension ShoeGaze {
|
|||||||
return try rebuildBoard(board, from: BoardState(label: board.label, segments: segments))
|
return try rebuildBoard(board, from: BoardState(label: board.label, segments: segments))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Moves a pedal from one lane to another (e.g. the main chain into a stereo-unzip lane, or
|
||||||
|
/// between branches), preserving its parameter values. The moved pedal is appended to the end
|
||||||
|
/// of the destination lane.
|
||||||
|
///
|
||||||
|
/// - Parameters:
|
||||||
|
/// - sourceLane: The lane the pedal currently lives in.
|
||||||
|
/// - sourceIndex: The pedal's index within `sourceLane`.
|
||||||
|
/// - destinationLane: The lane to move the pedal into.
|
||||||
|
/// - board: The board to edit.
|
||||||
|
/// - Returns: The rebuilt board occupying the same slot in `boards`.
|
||||||
|
/// - Throws: `ShoeGazeError.pedalIndexOutOfRange`, `.notABranchRegion`, or any rebuild error.
|
||||||
|
@discardableResult
|
||||||
|
public func movePedal(
|
||||||
|
from sourceLane: PedalLane,
|
||||||
|
at sourceIndex: Int,
|
||||||
|
to destinationLane: PedalLane,
|
||||||
|
in board: PedalBoard
|
||||||
|
) throws -> PedalBoard {
|
||||||
|
var segments: [BoardSegmentState] = board.captureState().segments
|
||||||
|
|
||||||
|
// 1. Remove the pedal from its source lane, capturing its full state. Removing a main
|
||||||
|
// pedal deletes a top-level segment; record where so the destination region index can
|
||||||
|
// be corrected if it sat after the removal.
|
||||||
|
let moved: PedalState
|
||||||
|
var removedTopLevelIndex: Int?
|
||||||
|
switch sourceLane {
|
||||||
|
case .main:
|
||||||
|
let positions: [Int] = linearPedalSegmentIndices(segments)
|
||||||
|
guard sourceIndex >= 0, sourceIndex < positions.count else {
|
||||||
|
throw ShoeGazeError.pedalIndexOutOfRange(index: sourceIndex, count: positions.count)
|
||||||
|
}
|
||||||
|
let absolute: Int = positions[sourceIndex]
|
||||||
|
guard case .pedal(let state) = segments[absolute] else {
|
||||||
|
throw ShoeGazeError.pedalIndexOutOfRange(index: sourceIndex, count: positions.count)
|
||||||
|
}
|
||||||
|
moved = state
|
||||||
|
segments.remove(at: absolute)
|
||||||
|
removedTopLevelIndex = absolute
|
||||||
|
case .left, .right:
|
||||||
|
var captured: PedalState?
|
||||||
|
try mutateBranch(&segments, lane: sourceLane) { branch in
|
||||||
|
guard sourceIndex >= 0, sourceIndex < branch.count else {
|
||||||
|
throw ShoeGazeError.pedalIndexOutOfRange(index: sourceIndex, count: branch.count)
|
||||||
|
}
|
||||||
|
captured = branch.remove(at: sourceIndex)
|
||||||
|
}
|
||||||
|
guard let capturedState: PedalState = captured else {
|
||||||
|
throw ShoeGazeError.pedalIndexOutOfRange(index: sourceIndex, count: 0)
|
||||||
|
}
|
||||||
|
moved = capturedState
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Correct the destination region index if a top-level segment before it was removed.
|
||||||
|
var destination: PedalLane = destinationLane
|
||||||
|
if let region: Int = destinationLane.regionIndex,
|
||||||
|
let removed: Int = removedTopLevelIndex, removed < region {
|
||||||
|
destination = destinationLane.isLeftBranch ? .left(region: region - 1) : .right(region: region - 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Append the moved pedal to the destination lane.
|
||||||
|
switch destination {
|
||||||
|
case .main:
|
||||||
|
let positions: [Int] = linearPedalSegmentIndices(segments)
|
||||||
|
if let lastPedal: Int = positions.last {
|
||||||
|
segments.insert(.pedal(moved), at: lastPedal + 1)
|
||||||
|
} else {
|
||||||
|
segments.append(.pedal(moved))
|
||||||
|
}
|
||||||
|
case .left, .right:
|
||||||
|
try mutateBranch(&segments, lane: destination) { branch in
|
||||||
|
branch.append(moved)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return try rebuildBoard(board, from: BoardState(label: board.label, segments: segments))
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - Branch regions
|
// MARK: - Branch regions
|
||||||
|
|
||||||
/// Appends an empty stereo split region (two independently authored L/R lanes) to the board.
|
/// Appends an empty stereo split region (two independently authored L/R lanes) to the board.
|
||||||
|
|||||||
@@ -325,6 +325,10 @@ public struct BoardFlowView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.frame(minWidth: BoardFlowView.laneMinWidth, alignment: .leading)
|
.frame(minWidth: BoardFlowView.laneMinWidth, alignment: .leading)
|
||||||
|
// Make the whole lane frame hit-testable: an empty lane is mostly transparent, so without
|
||||||
|
// this the drop target has almost no area and releases land on nothing (the bug where
|
||||||
|
// dropping into an empty Stereo Unzip / Split / Parallel lane did nothing).
|
||||||
|
.contentShape(Rectangle())
|
||||||
.overlay { dropOutline(active: dropTarget == laneID) }
|
.overlay { dropOutline(active: dropTarget == laneID) }
|
||||||
.dropDestination(for: String.self) { items, _ in
|
.dropDestination(for: String.self) { items, _ in
|
||||||
handleLaneDrop(items, lane: lane)
|
handleLaneDrop(items, lane: lane)
|
||||||
@@ -396,16 +400,19 @@ public struct BoardFlowView: View {
|
|||||||
reorderMain(from: src, onto: ontoLinear)
|
reorderMain(from: src, onto: ontoLinear)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
// A branch pedal dragged back onto the main chain → cross-lane move.
|
||||||
|
return moveAcross(payload, toLane: .main)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func handleLaneDrop(_ items: [String], lane: PedalLane) -> Bool {
|
private func handleLaneDrop(_ items: [String], lane: PedalLane) -> Bool {
|
||||||
dropTarget = nil
|
dropTarget = nil
|
||||||
guard let payload: String = parse(items), let type: String = payload.afterPrefix("add:") else {
|
guard let payload: String = parse(items) else { return false }
|
||||||
return false
|
if let type: String = payload.afterPrefix("add:") {
|
||||||
|
append(type: type, lane: lane)
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
append(type: type, lane: lane)
|
// A pedal from the main chain or another lane dragged into this lane → cross-lane move.
|
||||||
return true
|
return moveAcross(payload, toLane: lane)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func handleBranchCardDrop(_ items: [String], lane: PedalLane, ontoIndex: Int) -> Bool {
|
private func handleBranchCardDrop(_ items: [String], lane: PedalLane, ontoIndex: Int) -> Bool {
|
||||||
@@ -422,7 +429,7 @@ public struct BoardFlowView: View {
|
|||||||
append(type: type, lane: lane)
|
append(type: type, lane: lane)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// Reorder within the same lane only: "movebranch:<region>:<side>:<index>".
|
// Reorder within the same lane: "movebranch:<region>:<side>:<index>".
|
||||||
let parts: [Substring] = payload.split(separator: ":")
|
let parts: [Substring] = payload.split(separator: ":")
|
||||||
if parts.count == 4, parts[0] == "movebranch",
|
if parts.count == 4, parts[0] == "movebranch",
|
||||||
Int(parts[1]) == lane.regionIndex,
|
Int(parts[1]) == lane.regionIndex,
|
||||||
@@ -431,7 +438,35 @@ public struct BoardFlowView: View {
|
|||||||
reorderBranch(from: src, onto: ontoIndex, lane: lane)
|
reorderBranch(from: src, onto: ontoIndex, lane: lane)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
// A pedal from the main chain or a different lane dropped onto a card here → cross-lane move.
|
||||||
|
return moveAcross(payload, toLane: lane)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Moves a pedal addressed by a `movemain:`/`movebranch:` payload into `destination`,
|
||||||
|
/// preserving its parameters. Returns `false` if the payload isn't a recognised move.
|
||||||
|
private func moveAcross(_ payload: String, toLane destination: PedalLane) -> Bool {
|
||||||
|
guard let board: PedalBoard = board else { return false }
|
||||||
|
let sourceLane: PedalLane
|
||||||
|
let sourceIndex: Int
|
||||||
|
if let mainIndex: Int = payload.afterPrefix("movemain:").flatMap(Int.init) {
|
||||||
|
sourceLane = .main
|
||||||
|
sourceIndex = mainIndex
|
||||||
|
} else {
|
||||||
|
let parts: [Substring] = payload.split(separator: ":")
|
||||||
|
guard parts.count == 4, parts[0] == "movebranch",
|
||||||
|
let region: Int = Int(parts[1]), let index: Int = Int(parts[3]) else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
sourceLane = (parts[2] == "L") ? .left(region: region) : .right(region: region)
|
||||||
|
sourceIndex = index
|
||||||
|
}
|
||||||
|
do {
|
||||||
|
_ = try shoeGaze.movePedal(from: sourceLane, at: sourceIndex, to: destination, in: board)
|
||||||
|
return true
|
||||||
|
} catch {
|
||||||
|
print("[BoardFlowView] cross-lane move failed: \(error)")
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Edit actions
|
// MARK: - Edit actions
|
||||||
|
|||||||
@@ -216,8 +216,11 @@ public struct PedalView: View {
|
|||||||
private static let screwHalfSize: CGFloat = 4
|
private static let screwHalfSize: CGFloat = 4
|
||||||
private static let namePlateBackgroundOpacity: Double = 0.35
|
private static let namePlateBackgroundOpacity: Double = 0.35
|
||||||
private static let fontSizeNamePlate: CGFloat = 13
|
private static let fontSizeNamePlate: CGFloat = 13
|
||||||
/// Opacity of the trailing ⓘ info button on the name plate.
|
/// Opacity of the ⓘ info button.
|
||||||
private static let infoButtonOpacity: Double = 0.7
|
private static let infoButtonOpacity: Double = 0.7
|
||||||
|
/// Insets placing the ⓘ info button just under the top-left corner screw.
|
||||||
|
private static let infoButtonLeading: CGFloat = 5
|
||||||
|
private static let infoButtonTop: CGFloat = 20
|
||||||
private static let outerBorderLineWidth: CGFloat = 1.5
|
private static let outerBorderLineWidth: CGFloat = 1.5
|
||||||
private static let innerHighlightLineWidth: CGFloat = 1
|
private static let innerHighlightLineWidth: CGFloat = 1
|
||||||
private static let innerHighlightPadding: CGFloat = 1
|
private static let innerHighlightPadding: CGFloat = 1
|
||||||
@@ -283,6 +286,11 @@ public struct PedalView: View {
|
|||||||
|
|
||||||
// Corner screws — overlaid at the four corners
|
// Corner screws — overlaid at the four corners
|
||||||
screwCorners
|
screwCorners
|
||||||
|
|
||||||
|
// Info button, tucked just under the top-left corner screw.
|
||||||
|
infoButton
|
||||||
|
.padding(.leading, PedalView.infoButtonLeading)
|
||||||
|
.padding(.top, PedalView.infoButtonTop)
|
||||||
}
|
}
|
||||||
.frame(width: enclosureWidth(for: sliders))
|
.frame(width: enclosureWidth(for: sliders))
|
||||||
.shadow(
|
.shadow(
|
||||||
@@ -299,7 +307,7 @@ public struct PedalView: View {
|
|||||||
|
|
||||||
// MARK: - Subviews
|
// MARK: - Subviews
|
||||||
|
|
||||||
/// Capsule name plate near the top of the enclosure, with a trailing info button.
|
/// Capsule name plate near the top of the enclosure.
|
||||||
private var namePlate: some View {
|
private var namePlate: some View {
|
||||||
Text(pedal.displayName)
|
Text(pedal.displayName)
|
||||||
.font(.system(size: PedalView.fontSizeNamePlate, weight: .bold, design: .rounded))
|
.font(.system(size: PedalView.fontSizeNamePlate, weight: .bold, design: .rounded))
|
||||||
@@ -308,18 +316,19 @@ public struct PedalView: View {
|
|||||||
.padding(.vertical, PedalView.namePlatePaddingV)
|
.padding(.vertical, PedalView.namePlatePaddingV)
|
||||||
.background(Color.black.opacity(PedalView.namePlateBackgroundOpacity))
|
.background(Color.black.opacity(PedalView.namePlateBackgroundOpacity))
|
||||||
.clipShape(RoundedRectangle(cornerRadius: PedalView.namePlateCornerRadius))
|
.clipShape(RoundedRectangle(cornerRadius: PedalView.namePlateCornerRadius))
|
||||||
.frame(maxWidth: .infinity)
|
}
|
||||||
.overlay(alignment: .trailing) {
|
|
||||||
Button {
|
/// Info button tucked just under the top-left corner screw.
|
||||||
showInfo = true
|
private var infoButton: some View {
|
||||||
} label: {
|
Button {
|
||||||
Image(systemName: "info.circle")
|
showInfo = true
|
||||||
.font(.system(size: PedalView.fontSizeNamePlate))
|
} label: {
|
||||||
.foregroundStyle(Color.white.opacity(PedalView.infoButtonOpacity))
|
Image(systemName: "info.circle")
|
||||||
}
|
.font(.system(size: PedalView.fontSizeNamePlate))
|
||||||
.buttonStyle(.plain)
|
.foregroundStyle(Color.white.opacity(PedalView.infoButtonOpacity))
|
||||||
.help("About this pedal")
|
}
|
||||||
}
|
.buttonStyle(.plain)
|
||||||
|
.help("About this pedal")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Grid of the effect knobs, in rows of up to `knobColumnCount`.
|
/// Grid of the effect knobs, in rows of up to `knobColumnCount`.
|
||||||
|
|||||||
@@ -582,4 +582,54 @@ struct BoardEditAPITests {
|
|||||||
let samples: [Float] = try render(engine2, url2)
|
let samples: [Float] = try render(engine2, url2)
|
||||||
#expect(hasNonSilentOutput(samples), "loaded edited rig should render audio")
|
#expect(hasNonSilentOutput(samples), "loaded edited rig should render audio")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - Cross-lane move (drag a pedal into a region lane)
|
||||||
|
|
||||||
|
@Test func moveMainPedalIntoStereoUnzipLanePreservingParams() throws {
|
||||||
|
// Ping-Pong (stereo) then Overdrive on the main chain; unzip after Ping-Pong.
|
||||||
|
let (sg, engine, url, board): (ShoeGaze, SynthesisEngine, URL, PedalBoard) =
|
||||||
|
try makeRig(pedals: ["Ping-Pong", "Overdrive"])
|
||||||
|
defer { try? FileManager.default.removeItem(at: url) }
|
||||||
|
|
||||||
|
var live: PedalBoard = try sg.insertStereoUnzip(afterSegment: 0, in: board)
|
||||||
|
// Tweak the live Overdrive so we can verify its params survive the move.
|
||||||
|
let overdrive: OverdrivePedal? = live.pedals.compactMap { $0 as? OverdrivePedal }.first
|
||||||
|
overdrive?.drive = 11.0
|
||||||
|
|
||||||
|
// Move the Overdrive (main linear index 1) into the unzip's left lane (region segment 1).
|
||||||
|
live = try sg.movePedal(from: .main, at: 1, to: .left(region: 1), in: live)
|
||||||
|
|
||||||
|
#expect(names(live) == ["Ping-Pong"], "Overdrive should leave the main chain")
|
||||||
|
guard let state: StereoUnzipState = unzipState(live) else {
|
||||||
|
Issue.record("No stereo unzip segment")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
#expect(state.left.map { $0.type } == ["Overdrive"], "Overdrive should land in the left lane")
|
||||||
|
#expect(state.left.first?.knobValues.first == 11.0, "Drive param should survive the move")
|
||||||
|
|
||||||
|
let samples: [Float] = try render(engine, url)
|
||||||
|
#expect(hasNonSilentOutput(samples), "board renders after the cross-lane move")
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test func moveMainPedalBeforeUnzipRegionAdjustsIndex() throws {
|
||||||
|
// Overdrive (mono) then Ping-Pong (stereo); unzip after Ping-Pong. Moving the Overdrive —
|
||||||
|
// which sits BEFORE the unzip region — exercises the destination-index adjustment.
|
||||||
|
let (sg, engine, url, board): (ShoeGaze, SynthesisEngine, URL, PedalBoard) =
|
||||||
|
try makeRig(pedals: ["Overdrive", "Ping-Pong"])
|
||||||
|
defer { try? FileManager.default.removeItem(at: url) }
|
||||||
|
|
||||||
|
var live: PedalBoard = try sg.insertStereoUnzip(afterSegment: 1, in: board)
|
||||||
|
// Unzip is top-level segment 2; Overdrive is main linear index 0 (top-level segment 0).
|
||||||
|
live = try sg.movePedal(from: .main, at: 0, to: .left(region: 2), in: live)
|
||||||
|
|
||||||
|
#expect(names(live) == ["Ping-Pong"], "Overdrive should leave the main chain")
|
||||||
|
guard let state: StereoUnzipState = unzipState(live) else {
|
||||||
|
Issue.record("No stereo unzip segment")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
#expect(state.left.map { $0.type } == ["Overdrive"], "Overdrive should land in the left lane")
|
||||||
|
|
||||||
|
let samples: [Float] = try render(engine, url)
|
||||||
|
#expect(hasNonSilentOutput(samples), "board renders after the index-adjusted move")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user