feat(amps): channel-switch enabler + drive-channel amps (Phase 4)
Enabler: - PedalSwitch.rebuildsOnChange (mirrors PedalSelectorKnob): a switch that changes graph topology asks the host to rebuild. Wired through PedalSwitchView (onCommit on a changed tap) and PedalView.switchRow → pedalRebuildAction. - AmpVoicePedal.preampStage(_:) overridable hook (default: one TriodeStage at Gain). preCabinetCore feeds it; a channel amp cascades an extra stage on its drive channel. Named preampOversample constant (4). Amps: - Fullerton Drive — American two-channel combo: blackface Clean + an overdrive channel (cascaded TriodeStage set by Drive), spring reverb, Bright. Channel switch is rebuildsOnChange, so only the selected channel's stages are built. - Jazz Clean — add the JC onboard Distortion channel (Clean/Dist switch + Drive knob) via the same preampStage cascade; flows through its stereo wideEffect. Registered Fullerton Drive across 6 sites as .amp. 22 tests across the two amps (channel switch changes output, drive knob, rebuildsOnChange, ceiling on the drive channel, control surface, round-trip, registry). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -123,6 +123,16 @@ struct JazzCleanAmpPedalTests {
|
||||
#expect(windowedSSD(flat, bright) > 0, "bright switch had no effect")
|
||||
}
|
||||
|
||||
@Test func distortionChannelChangesOutput() throws {
|
||||
// Channel is read at build time (rebuildsOnChange); configure runs before build, so the
|
||||
// Distortion channel cascades its extra gain stage.
|
||||
let clean: [Float] = try renderStereo { $0.channel = 0.0 }.left
|
||||
let dist: [Float] = try renderStereo { $0.channel = 1.0; $0.drive = 18.0 }.left
|
||||
#expect(windowedSSD(clean, dist) > 0, "distortion channel had no effect")
|
||||
let channel: PedalSwitch? = JazzCleanAmpPedal().effectSwitches.first { $0.label == "Channel" }
|
||||
#expect(channel?.rebuildsOnChange == true, "Channel switch should rebuild on change")
|
||||
}
|
||||
|
||||
@Test func bothChannelsStayWithinCeilingWithFXEngaged() throws {
|
||||
let ceilingEpsilon: Double = 1.0e-4
|
||||
let (left, right): ([Float], [Float]) = try renderStereo { (pedal: JazzCleanAmpPedal) in
|
||||
@@ -141,8 +151,8 @@ struct JazzCleanAmpPedalTests {
|
||||
@Test func exposesFullControlSurface() throws {
|
||||
let pedal: JazzCleanAmpPedal = JazzCleanAmpPedal()
|
||||
#expect(pedal.effectKnobs.map { $0.label }
|
||||
== ["Gain", "Bass", "Mid", "Treble", "Reverb", "Rate", "Depth"])
|
||||
#expect(pedal.effectSwitches.map { $0.label } == ["Bright", "Chorus"])
|
||||
== ["Gain", "Bass", "Mid", "Treble", "Reverb", "Rate", "Depth", "Drive"])
|
||||
#expect(pedal.effectSwitches.map { $0.label } == ["Bright", "Chorus", "Channel"])
|
||||
#expect(pedal.effectSelectors.map { $0.label } == ["Cab"])
|
||||
#expect(pedal.effectSelectors.first?.rebuildsOnChange == true)
|
||||
#expect(pedal.widthUnits == 3)
|
||||
@@ -159,6 +169,8 @@ struct JazzCleanAmpPedalTests {
|
||||
pedal.chorusDepth = 0.008
|
||||
pedal.bright = 1.0
|
||||
pedal.chorusEnabled = 0.0
|
||||
pedal.channel = 1.0
|
||||
pedal.drive = 11.0
|
||||
pedal.cab = 3.0
|
||||
let restored: JazzCleanAmpPedal = JazzCleanAmpPedal()
|
||||
restored.applyState(pedal.captureState())
|
||||
@@ -168,6 +180,7 @@ struct JazzCleanAmpPedalTests {
|
||||
#expect(restored.chorusDepth == 0.008)
|
||||
#expect(restored.bright == 1.0)
|
||||
#expect(restored.chorusEnabled == 0.0)
|
||||
#expect(restored.channel == 1.0 && restored.drive == 11.0)
|
||||
#expect(restored.cab == 3.0)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user