Compare commits
4 Commits
52c676605f
..
v3.4.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 3ef09a771a | |||
| 3f05cfa416 | |||
| 4cae1e6fd0 | |||
| 24ac361c48 |
@@ -196,9 +196,18 @@ public final class TunedVerbPedal: Pedal {
|
||||
stages: [.dual(map, sideChain: sideChain)]
|
||||
)
|
||||
|
||||
// Gate the wash by the Capture latch. Until a moment is captured there is no filter template,
|
||||
// so the reverb must be fed silence rather than the live pass-through — otherwise an
|
||||
// uncaptured TunedVerb pours the dry signal straight into the tail. `captured` is `0` until the
|
||||
// footswitch fires and is reset to `0` on every rebuild and on engine stop (`resetForRebuild`
|
||||
// / `releaseHold`), so a fresh app launch or an engine restart comes up silent with no stale
|
||||
// capture. The analysis side-chain inside `masked` keeps tracking while gated, so pressing
|
||||
// Capture still freezes the current-moment spectrum.
|
||||
let gatedIntoVerb: any ValidGeneratorInput = masked * $captured
|
||||
|
||||
// A large room for a cavernous tail; `time` sets the T60, `damp` the brightness.
|
||||
let reverb: GVerb.Audio = GVerb.Audio(
|
||||
source: masked,
|
||||
source: gatedIntoVerb,
|
||||
roomSize: roomSize,
|
||||
reverbTime: $time,
|
||||
damping: $damp,
|
||||
|
||||
@@ -63,6 +63,12 @@ public struct BoardFlowView: View {
|
||||
private let shoeGaze: ShoeGaze
|
||||
private let boardIndex: Int
|
||||
|
||||
/// When `true`, the view sizes to its content height and scrolls only horizontally, so it can sit
|
||||
/// inside an outer vertical scroller (the pre-board → board → post-board page) without a nested
|
||||
/// vertical scroll. When `false` (the default), it fills the available height and centres the
|
||||
/// chain, adding a vertical scroll only for tall parallel splits.
|
||||
private let sizesToContent: Bool
|
||||
|
||||
/// Undo coordinator injected by ``ShoeGazeBuilderView``; `nil` in lightweight hosts (previews),
|
||||
/// where edits run directly without recording history.
|
||||
@Environment(UndoCoordinator.self) private var undo: UndoCoordinator?
|
||||
@@ -74,9 +80,10 @@ public struct BoardFlowView: View {
|
||||
/// lanes exceed the viewport height (tall parallel splits). Otherwise scrolling stays horizontal.
|
||||
@State private var contentHeight: CGFloat = 0
|
||||
|
||||
public init(shoeGaze: ShoeGaze, boardIndex: Int) {
|
||||
public init(shoeGaze: ShoeGaze, boardIndex: Int, sizesToContent: Bool = false) {
|
||||
self.shoeGaze = shoeGaze
|
||||
self.boardIndex = boardIndex
|
||||
self.sizesToContent = sizesToContent
|
||||
}
|
||||
|
||||
// MARK: - Body
|
||||
@@ -91,9 +98,22 @@ public struct BoardFlowView: View {
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func flow(board: PedalBoard) -> some View {
|
||||
let stages: [StageModel] = stageModels(board: board)
|
||||
return GeometryReader { proxy in
|
||||
if sizesToContent {
|
||||
// One-scroller mode: the board is only as tall as its chain and scrolls horizontally,
|
||||
// so the outer vertical scroller flows pre-board → board → post-board as one page with
|
||||
// no nested vertical scroll. A tall parallel split simply makes the page taller.
|
||||
ScrollView(.horizontal, showsIndicators: true) {
|
||||
chainRow(board: board, stages: stages)
|
||||
}
|
||||
.frame(height: contentHeight > 0 ? contentHeight : nil)
|
||||
.onPreferenceChange(BoardFlowContentHeightKey.self) { height in
|
||||
contentHeight = height
|
||||
}
|
||||
} else {
|
||||
GeometryReader { proxy in
|
||||
let viewportHeight: CGFloat = proxy.size.height
|
||||
// Lock to horizontal, adding the vertical axis only when the chain is taller than the
|
||||
// viewport (deep parallel splits) so it can be reached instead of clipped.
|
||||
@@ -118,6 +138,7 @@ public struct BoardFlowView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The left→right chain of endpoints, connectors and stage cards. Reports its own intrinsic
|
||||
/// height through `BoardFlowContentHeightKey` so `flow` can decide whether vertical scrolling is
|
||||
|
||||
@@ -90,6 +90,14 @@ public struct HelpView: View {
|
||||
+ "insert before it; tap a palette pedal to append.",
|
||||
"Add boards with +. Solo / Blend / All choose which boards you hear; XFade sets the "
|
||||
+ "crossfade time; each board has S (solo) and B (bypass).",
|
||||
"Pre-board is one chain that processes your input once, before the board split, and "
|
||||
+ "feeds every board — good for a shared tuner, compressor, or noise gate. Tap "
|
||||
+ "+ Pre-board to start it; it hides when empty.",
|
||||
"Post-board is one chain after all boards are mixed down — good for a global reverb, "
|
||||
+ "a limiter, or a final EQ across the whole rig. Tap + Post-board to start it; it "
|
||||
+ "hides when empty.",
|
||||
"Pre-board, the boards, and post-board scroll together top-to-bottom as one signal "
|
||||
+ "path; each board's chain scrolls sideways.",
|
||||
"The Rigs sidebar lists saved rigs, with New, Save, Save As, Duplicate, Rename, "
|
||||
+ "Delete, and Erase All.",
|
||||
"Reorder rigs into a set list by dragging a row, or via each rig's Move Up / "
|
||||
|
||||
@@ -726,10 +726,19 @@ public struct ShoeGazeBuilderView: View {
|
||||
}
|
||||
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
|
||||
ControlMappingLegend()
|
||||
// Pre-board, the board canvas and post-board share a single vertical scroller, so the whole
|
||||
// signal path reads top-to-bottom as one page (on macOS and iOS alike) instead of pinning
|
||||
// the board and clipping the pre/post strips.
|
||||
ScrollView(.vertical, showsIndicators: true) {
|
||||
VStack(alignment: .leading, spacing: ShoeGazeBuilderView.sectionSpacing) {
|
||||
preBoardStrip
|
||||
boardArea
|
||||
postBoardStrip
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .topLeading)
|
||||
}
|
||||
.frame(maxHeight: .infinity)
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
||||
// Make the undo coordinator reachable to every board / palette subview so their structural
|
||||
// edits record history. Optional-object injection: `nil` resolves `@Environment(...)` to nil.
|
||||
@@ -1598,13 +1607,11 @@ public struct ShoeGazeBuilderView: View {
|
||||
// MARK: - Board area
|
||||
|
||||
private var boardArea: some View {
|
||||
// Vertically center the signal-flow board in the available space.
|
||||
VStack(spacing: 0) {
|
||||
Spacer(minLength: 0)
|
||||
BoardFlowView(shoeGaze: shoeGaze, boardIndex: clampedBoardIndex)
|
||||
Spacer(minLength: 0)
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
// Content-sized so it flows inside the shared pre/board/post vertical scroller (scrolls
|
||||
// horizontally for a long chain; a tall parallel split grows the page). No vertical centering —
|
||||
// the board sits in signal-flow order between the pre-board and post-board strips.
|
||||
BoardFlowView(shoeGaze: shoeGaze, boardIndex: clampedBoardIndex, sizesToContent: true)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
|
||||
/// Performs a routing action from the palette against the selected board.
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import SwiftUI
|
||||
import LyrebirdUI
|
||||
import LyrebirdSynth
|
||||
import LyrebirdShoeGaze
|
||||
|
||||
/// A vertical fader bound to a single ``UIParamNode``.
|
||||
///
|
||||
|
||||
@@ -188,47 +188,87 @@ struct TunedVerbPedalTests {
|
||||
}
|
||||
|
||||
@Test func panShiftsTheLeftLeg() throws {
|
||||
// Fully wet, the output follows the panned wash. Hard left fills the left leg; hard right
|
||||
// nearly empties it. (Tests exercise the left output leg; the right is board-wired live.)
|
||||
let hardLeft: [Float] = try render(duration: 0.6) { pedal in pedal.mix = 1.0; pedal.pan = -1.0 }
|
||||
let hardRight: [Float] = try render(duration: 0.6) { pedal in pedal.mix = 1.0; pedal.pan = 1.0 }
|
||||
let leftRMS: Double = rms(hardLeft, loFrame: 0, hiFrame: hardLeft.count)
|
||||
let rightRMS: Double = rms(hardRight, loFrame: 0, hiFrame: hardRight.count)
|
||||
// Fully wet, the output follows the panned wash — but the wash only exists after a capture, so
|
||||
// capture early, then measure. Hard left fills the left leg; hard right nearly empties it.
|
||||
// (`stepRender` returns the left output bus; the right is board-wired live.)
|
||||
let blockSize: Int = 512
|
||||
let totalFrames: Int = Int(0.8 * sampleRate)
|
||||
let captureFrame: Int = Int(0.1 * sampleRate)
|
||||
let windowLo: Int = Int(0.4 * sampleRate)
|
||||
|
||||
func leftLeg(pan: Double) throws -> [Float] {
|
||||
var captured: Bool = false
|
||||
return try stepRender(totalFrames: totalFrames, blockSize: blockSize) { pedal in
|
||||
pedal.mix = 1.0; pedal.pan = pan; pedal.time = 2.0
|
||||
} onFrame: { frame, _, pedal in
|
||||
if frame >= captureFrame, !captured { pedal.toggleCapture(); captured = true }
|
||||
}
|
||||
}
|
||||
|
||||
let hardLeft: [Float] = try leftLeg(pan: -1.0)
|
||||
let hardRight: [Float] = try leftLeg(pan: 1.0)
|
||||
let leftRMS: Double = rms(hardLeft, loFrame: windowLo, hiFrame: hardLeft.count)
|
||||
let rightRMS: Double = rms(hardRight, loFrame: windowLo, hiFrame: hardRight.count)
|
||||
#expect(leftRMS > rightRMS * 3.0,
|
||||
"panning hard left should fill the left leg far more than hard right: L \(leftRMS) vs R \(rightRMS)")
|
||||
}
|
||||
|
||||
@Test func captureLocksTheFilterSoAChangedInputIsShapedDifferently() throws {
|
||||
// Capture the filter on tone A, then morph the input to tone B. A locked filter (shaped by A)
|
||||
// masks B differently than a filter that keeps tracking the live input — so the two renders
|
||||
// diverge once the input has changed.
|
||||
@Test func wetIsSilentUntilCaptureThenAudible() throws {
|
||||
// Core contract: with no captured moment there is no filter template, so a fully-wet TunedVerb
|
||||
// must output silence — not the live pass-through poured into the reverb. After the Capture
|
||||
// footswitch fires, the wash appears. Fully wet (mix 1.0) so the only output is the gated wash.
|
||||
let blockSize: Int = 512
|
||||
let totalFrames: Int = Int(1.4 * sampleRate)
|
||||
let captureFrame: Int = Int(0.5 * sampleRate)
|
||||
|
||||
var captured: Bool = false
|
||||
let out: [Float] = try stepRender(totalFrames: totalFrames, blockSize: blockSize) { pedal in
|
||||
pedal.mix = 1.0; pedal.time = 1.0
|
||||
} onFrame: { frame, _, pedal in
|
||||
if frame >= captureFrame, !captured { pedal.toggleCapture(); captured = true }
|
||||
}
|
||||
|
||||
// Before capture: fully-wet output must be silent (reverb fed zero).
|
||||
let preRMS: Double = rms(out, loFrame: 0, hiFrame: captureFrame - blockSize)
|
||||
// Well after capture (give the reverb time to build): audible.
|
||||
let postRMS: Double = rms(out, loFrame: captureFrame + Int(0.4 * sampleRate), hiFrame: out.count)
|
||||
#expect(preRMS < 1.0e-6, "an uncaptured fully-wet TunedVerb must be silent, got \(preRMS)")
|
||||
#expect(postRMS > 1.0e-4, "after Capture the wash must be audible, got \(postRMS)")
|
||||
}
|
||||
|
||||
@Test func captureLocksTheFilterSoAChangedInputIsShapedDifferently() throws {
|
||||
// Which moment you capture determines the filter. Capture on tone A then morph to B (the wash
|
||||
// on B is shaped by A's spectrum) versus morph to B first then capture on B (shaped by B's own
|
||||
// spectrum). Both are audible — the wash exists only after a capture — but the two locked
|
||||
// templates mask the ongoing tone-B input differently, so the renders diverge.
|
||||
let blockSize: Int = 512
|
||||
let totalFrames: Int = Int(1.4 * sampleRate)
|
||||
let captureFrame: Int = Int(0.4 * sampleRate)
|
||||
let morphFrame: Int = Int(0.6 * sampleRate)
|
||||
let windowLo: Int = Int(0.95 * sampleRate)
|
||||
let windowHi: Int = Int(1.35 * sampleRate)
|
||||
|
||||
var captured: Bool = false
|
||||
let locked: [Float] = try stepRender(totalFrames: totalFrames, blockSize: blockSize) { pedal in
|
||||
// Locked on tone A, then morphed to B.
|
||||
var capturedA: Bool = false
|
||||
let lockedOnA: [Float] = try stepRender(totalFrames: totalFrames, blockSize: blockSize) { pedal in
|
||||
pedal.mix = 1.0; pedal.time = 3.0
|
||||
} onFrame: { frame, source, pedal in
|
||||
if frame >= captureFrame, !captured { pedal.toggleCapture(); captured = true }
|
||||
if frame >= morphFrame { source.morph = 1.0 } // switch to tone B
|
||||
if frame >= Int(0.4 * sampleRate), !capturedA { pedal.toggleCapture(); capturedA = true }
|
||||
if frame >= Int(0.6 * sampleRate) { source.morph = 1.0 } // switch to tone B after capture
|
||||
}
|
||||
|
||||
let tracking: [Float] = try stepRender(totalFrames: totalFrames, blockSize: blockSize) { pedal in
|
||||
// Morphed to B first, then locked on B.
|
||||
var capturedB: Bool = false
|
||||
let lockedOnB: [Float] = try stepRender(totalFrames: totalFrames, blockSize: blockSize) { pedal in
|
||||
pedal.mix = 1.0; pedal.time = 3.0
|
||||
} onFrame: { frame, source, _ in
|
||||
// Never capture; morph at the same frame.
|
||||
if frame >= morphFrame { source.morph = 1.0 }
|
||||
} onFrame: { frame, source, pedal in
|
||||
if frame >= Int(0.2 * sampleRate) { source.morph = 1.0 } // switch to tone B first
|
||||
if frame >= Int(0.4 * sampleRate), !capturedB { pedal.toggleCapture(); capturedB = true }
|
||||
}
|
||||
|
||||
let signal: Double = rms(tracking, loFrame: windowLo, hiFrame: windowHi)
|
||||
let diff: Double = rmsDiff(locked, tracking, loFrame: windowLo, hiFrame: windowHi)
|
||||
#expect(signal > 1.0e-4, "control render should be audible on tone B, got \(signal)")
|
||||
let signal: Double = rms(lockedOnB, loFrame: windowLo, hiFrame: windowHi)
|
||||
let diff: Double = rmsDiff(lockedOnA, lockedOnB, loFrame: windowLo, hiFrame: windowHi)
|
||||
#expect(signal > 1.0e-4, "a captured render should be audible on tone B, got \(signal)")
|
||||
#expect(diff > signal * 0.25,
|
||||
"a captured filter should shape the changed input differently: diff \(diff) vs signal \(signal)")
|
||||
"locking a different moment should shape the input differently: diff \(diff) vs signal \(signal)")
|
||||
}
|
||||
|
||||
// MARK: - Bypass
|
||||
|
||||
Reference in New Issue
Block a user