diff --git a/Sources/LyrebirdShoeGaze/Pedals/CabinetPedal.swift b/Sources/LyrebirdShoeGaze/Pedals/CabinetPedal.swift index 31fc4c9..5c455e8 100644 --- a/Sources/LyrebirdShoeGaze/Pedals/CabinetPedal.swift +++ b/Sources/LyrebirdShoeGaze/Pedals/CabinetPedal.swift @@ -18,7 +18,10 @@ import LyrebirdUI /// /// Signal path (inside `effect(_:)`): /// ``` -/// dry → ConvolutionReverb(ir: selectedVoice) → mono out +/// dry → ConvolutionReverb(ir: cab voice + mic voice) (one IR — mic colour baked in) +/// → RBJHighShelf (Position) → RBJLowShelf (Proximity) (live mic-placement shelves) +/// → LookAheadLimiter(±1) (transparent peak safety) +/// → mono out /// ``` /// /// The wet/dry mix and bypass are handled by the `Pedal` base class. @@ -32,6 +35,9 @@ import LyrebirdUI /// Inherits `mix`, `bypass`, and `level` from `Pedal`, plus: /// /// - `cabinet`: Selects the built-in cabinet voicing (stepped selector over ``CabinetVoice``). +/// - `mic`: Selects the microphone voicing baked into the IR (stepped selector over ``MicVoice``). +/// - `position` / `proximity`: Live mic-placement shelves in the advanced pop-over (on-axis ↔ edge, +/// distant ↔ close). public final class CabinetPedal: Pedal { /// One-line description shown in the picker and info panel. diff --git a/Tests/LyrebirdShoeGazeTests/CabinetPedalTests.swift b/Tests/LyrebirdShoeGazeTests/CabinetPedalTests.swift index 3e25abd..7294759 100644 --- a/Tests/LyrebirdShoeGazeTests/CabinetPedalTests.swift +++ b/Tests/LyrebirdShoeGazeTests/CabinetPedalTests.swift @@ -97,6 +97,7 @@ struct CabinetPedalTests { let onAxis: [Float] = try render { $0.position = 0.0 } let edge: [Float] = try render { $0.position = 1.0 } let skip: Int = 4096, window: Int = 4096 + #expect(onAxis.count >= skip + window && edge.count >= skip + window, "render too short") guard onAxis.count >= skip + window, edge.count >= skip + window else { return } let ssd: Double = zip(onAxis[skip..<(skip + window)], edge[skip..<(skip + window)]).reduce(0.0) { acc, pair in let d: Double = Double(pair.0 - pair.1); return acc + d * d @@ -109,6 +110,7 @@ struct CabinetPedalTests { let distant: [Float] = try render { $0.proximity = 0.0 } let close: [Float] = try render { $0.proximity = 1.0 } let skip: Int = 4096, window: Int = 4096 + #expect(distant.count >= skip + window && close.count >= skip + window, "render too short") guard distant.count >= skip + window, close.count >= skip + window else { return } let ssd: Double = zip(distant[skip..<(skip + window)], close[skip..<(skip + window)]).reduce(0.0) { acc, pair in let d: Double = Double(pair.0 - pair.1); return acc + d * d @@ -116,18 +118,20 @@ struct CabinetPedalTests { #expect(ssd > 0, "mic Proximity had no effect on output") } - @Test func placementDefaultsAreNeutral() throws { - // Position = 0 and Proximity = 0 map to 0 dB shelves (bit-exact identity), so setting them - // explicitly to the defaults must match the default render exactly — no placement coloration - // for cabs saved before placement existed. + @Test func explicitDefaultPlacementMatchesImplicit() throws { + // A default-consistency guard: the shipped defaults are position = 0 / proximity = 0, so + // setting them explicitly must reproduce the default render exactly. (That those defaults are + // a *no-op* on the tone follows from the RBJ shelves collapsing to unity at 0 dB — a Lyrebird + // property; this test pins that the defaults are those values and the render is deterministic.) let byDefault: [Float] = try render() let explicit: [Float] = try render { $0.position = 0.0; $0.proximity = 0.0 } let skip: Int = 4096, window: Int = 4096 + #expect(byDefault.count >= skip + window && explicit.count >= skip + window, "render too short") guard byDefault.count >= skip + window, explicit.count >= skip + window else { return } let ssd: Double = zip(byDefault[skip..<(skip + window)], explicit[skip..<(skip + window)]).reduce(0.0) { acc, pair in let d: Double = Double(pair.0 - pair.1); return acc + d * d } - #expect(ssd == 0, "neutral Position/Proximity is not a bit-exact identity") + #expect(ssd == 0, "explicit default placement did not match the default render") } @Test func advancedKnobsExposePlacement() throws {