fix(amps): Phase 1 review nits — docs, redundant init, test style

- AmpVoicePedal: powerAmpDriveInput / powerAmpOversample docs now cover the
  lower-headroom-variant case (fixed higher drive), not just master-volume amps.
- FullertonReverbAmpPedal: drop the redundant override init(name:) — the class
  inherits AmpVoicePedal's designated init, so the convenience init and the
  subclasses' super.init(name:) resolve without it.
- FullertonDeluxe doc: correct "2×12 Twin"/"Master drives" wording (both share
  the American cab; the difference is a higher fixed power-amp drive).
- Tests: explicit for-loop binding type annotations; accurate diff comment.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-03 12:02:32 -07:00
parent 8a08264fb4
commit 690030a4c5
4 changed files with 24 additions and 29 deletions
@@ -85,17 +85,19 @@ open class AmpVoicePedal: Pedal {
signal
}
/// Drive into the power-amp `TriodeStage`. Defaults to the fixed power-amp drive; a
/// master-volume amp overrides this to return a live `Master` knob mapped to a drive range, so
/// turning Master up pushes the power-amp stage into saturation — the real master-volume
/// behaviour — rather than merely attenuating the finished output the way `level` does. Non-
/// master amps leave it at the fixed value and are unaffected.
/// Drive into the power-amp `TriodeStage`. Defaults to the fixed power-amp drive. Two kinds of
/// amp override it: a **master-volume** amp returns a live `Master` knob mapped to a drive range
/// (turning Master up pushes the power-amp stage into saturation — the real master-volume
/// behaviour, unlike `level`, which only attenuates the finished output); a **lower-headroom
/// variant** returns a fixed value *higher* than the default to model an amp that breaks up
/// earlier. Either way, higher drive = more power-amp saturation.
open var powerAmpDriveInput: any ValidGeneratorInput { powerAmpDrive }
/// Oversampling factor for the power-amp stage — `2` or `4`. Amps that drive the power amp hard
/// (a `Master` control) override to `4` for more anti-alias headroom, since higher drive
/// Oversampling factor for the power-amp stage — `2` or `4`. Any amp that drives the power amp
/// harder than the default fixed value (a `Master` control, or a lower-headroom variant with a
/// higher fixed drive) should override to `4` for more anti-alias headroom, since higher drive
/// generates more high-order harmonics. Defaults to `2` (ample for the lightly-driven fixed
/// power stage of the non-master amps).
/// power stage of the standard voices).
open var powerAmpOversample: Int { 2 }
// MARK: - Constants
@@ -7,21 +7,22 @@
import LyrebirdSynth
import LyrebirdUI
/// American blackface **1×12 combo** — the lower-powered sibling of ``FullertonReverbAmpPedal``.
/// American blackface **lower-headroom combo** — the smaller-powered sibling of
/// ``FullertonReverbAmpPedal``.
///
/// Same reverb + tremolo + Bright control surface, but with less clean headroom: the power-amp
/// stage is driven harder so it breaks up earlier and grittier than the big 2×12 Twin voice. The
/// go-to blackface combo tone.
/// Same reverb + tremolo + Bright control surface and American cab, but with less clean headroom:
/// the power-amp stage runs a higher fixed drive than the Twin, so it breaks up earlier and grittier.
/// The go-to blackface combo tone.
public final class FullertonDeluxeAmpPedal: FullertonReverbAmpPedal {
/// Power-amp drive — higher than the Twin's fixed `1.5` so it saturates earlier (less headroom).
private let deluxePowerDrive: Double = 2.2
public override var summaryText: String {
"American 1×12 combo — earlier-breakup blackface tone with reverb, tremolo, and Bright."
"American combo — earlier-breakup blackface tone with reverb, tremolo, and Bright."
}
/// Master drives the power amp harder than the Twin, so 4× oversampling for anti-alias headroom.
/// Fixed power-amp drive is higher than the Twin's, so 4× oversampling for anti-alias headroom.
public override var powerAmpOversample: Int { 4 }
public override var powerAmpDriveInput: any ValidGeneratorInput { deluxePowerDrive }
@@ -83,22 +83,14 @@ open class FullertonReverbAmpPedal: AmpVoicePedal {
/// - Parameters:
/// - inputBus: Audio bus index to read the dry input from. Defaults to `0`.
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
/// The blackface-combo variants (Deluxe / Princeton) call the inherited
/// `AmpVoicePedal.init(name:inputBus:outputBus:)` designated init to set their own name while
/// inheriting the shared reverb + tremolo + bright control surface.
public convenience init(inputBus: Int = 0, outputBus: Int = 0) {
self.init(name: "Fullerton Reverb", inputBus: inputBus, outputBus: outputBus)
gain = 4.0 // headroom-rich clean default
}
/// Designated init used by the blackface-combo variants (Deluxe / Princeton) to set their own
/// name while inheriting the shared reverb + tremolo + bright control surface.
///
/// - Parameters:
/// - name: Display name for this amp voice.
/// - inputBus: Audio bus index to read the dry input from. Defaults to `0`.
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public override init(name: String, inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: name, inputBus: inputBus, outputBus: outputBus)
}
// MARK: - Switches
public override var effectSwitches: [PedalSwitch] {
@@ -55,7 +55,7 @@ struct FullertonVariantsTests {
]
@Test func bothBuildNonSilentFinite() throws {
for v in variants {
for v: (name: String, make: () -> FullertonReverbAmpPedal) in variants {
let s: [Float] = try render(v.make)
#expect(hasNonSilentOutput(s), "\(v.name) produced silence")
#expect(s.allSatisfy { $0.isFinite }, "\(v.name) produced non-finite output")
@@ -63,7 +63,7 @@ struct FullertonVariantsTests {
}
@Test func variantsDifferFromTwinAndEachOther() throws {
// Same knob settings, different voicing (power-amp drive + cab) → different output.
// Same knob settings, different voicing (power-amp drive; plus cab for Princeton) → different output.
let cfg: (FullertonReverbAmpPedal) -> Void = { $0.gain = 6.0; $0.reverb = 0.3 }
let twin: [Float] = try render({ FullertonReverbAmpPedal() }, configure: cfg)
let deluxe: [Float] = try render({ FullertonDeluxeAmpPedal() }, configure: cfg)
@@ -84,7 +84,7 @@ struct FullertonVariantsTests {
@Test func stayWithinCeilingAtMaxGain() throws {
let ceilingEpsilon: Double = 1.0e-4
for v in variants {
for v: (name: String, make: () -> FullertonReverbAmpPedal) in variants {
let hot: [Float] = try render(v.make) { (pedal: FullertonReverbAmpPedal) in
pedal.gain = 30.0
pedal.bass = 1.0
@@ -99,7 +99,7 @@ struct FullertonVariantsTests {
}
@Test func inheritFullControlSurface() throws {
for v in variants {
for v: (name: String, make: () -> FullertonReverbAmpPedal) in variants {
let pedal: FullertonReverbAmpPedal = v.make()
#expect(pedal.effectKnobs.map { $0.label }
== ["Gain", "Bass", "Mid", "Treble", "Reverb", "Speed", "Intensity"], "\(v.name) knobs")