feat(amp): shared power-amp Sag + Bias in an advanced pop-over

Phase 11. Promote Sag from Modern High-Gain to a shared AmpVoicePedal
capability and add a Bias control, both surfaced in a new pedal-card
pop-over rather than on the amp face.

- AmpVoicePedal gains `sag` [0,1] (AmplitudeFollower gain-droop, clamped
  [0.15,1] to prevent phase inversion) and `bias` [0,1] mapped to the
  power-amp TriodeStage grid bias ([-0.25,0.25], neutral 0.5 → 0.0 so
  existing voices are unchanged at defaults). Both applied in
  preCabinetCore; new `applySag(_:)` + `powerAmpBiasInput` helpers.
- Modern High-Gain drops its bespoke sag (now inherited); keeps sag=0.3
  default. Sag moves off its face into the pop-over.
- Pedal gains an `advancedKnobs` surface; PedalView draws a gear button
  (top-right) presenting them in a popover, reusing the existing pattern.
- Advanced knobs round-trip through PedalState (new `advancedValues`,
  backward-compatible decode) and are MIDI-CC-mappable (appended last).

De-branding (review nits): "Vox" removed from the Chime family's
user-visible summaries + docs; "Fullerton Princeton" renamed to display
"Fullerton Ivy League". Palette horizontal picker second row now shows
Routing before the Amp Model group.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-03 21:08:23 -07:00
parent 6cf698dbac
commit 1de14fd879
18 changed files with 273 additions and 77 deletions
+65 -5
View File
@@ -34,15 +34,15 @@ private func enclosureColor(for displayName: String) -> Color {
case "Anaheim": return Color(red: 0.24, green: 0.30, blue: 0.32) // hybrid slate
case "Modern High-Gain": return Color(red: 0.12, green: 0.12, blue: 0.14) // recto black
case "Chime": return Color(red: 0.16, green: 0.24, blue: 0.22) // vintage green
case "Chime 15": return Color(red: 0.18, green: 0.28, blue: 0.22) // brighter vox green
case "Chime Normal": return Color(red: 0.20, green: 0.26, blue: 0.20) // warm vox green
case "Chime Baby": return Color(red: 0.22, green: 0.30, blue: 0.24) // pale vox green
case "Chime 15": return Color(red: 0.18, green: 0.28, blue: 0.22) // brighter chime green
case "Chime Normal": return Color(red: 0.20, green: 0.26, blue: 0.20) // warm chime green
case "Chime Baby": return Color(red: 0.22, green: 0.30, blue: 0.24) // pale chime green
case "Fullerton Reverb": return Color(red: 0.15, green: 0.22, blue: 0.30) // blackface panel
case "Fullerton Deluxe": return Color(red: 0.17, green: 0.20, blue: 0.26) // blackface, warmer
case "Fullerton Princeton": return Color(red: 0.19, green: 0.19, blue: 0.23) // small blackface
case "Fullerton Ivy League": return Color(red: 0.19, green: 0.19, blue: 0.23) // small blackface
case "Fullerton Drive": return Color(red: 0.22, green: 0.18, blue: 0.24) // two-channel combo
case "Jazz Clean": return Color(red: 0.14, green: 0.30, blue: 0.34) // solid-state silver-teal
case "Chime Top Boost": return Color(red: 0.20, green: 0.32, blue: 0.20) // vox-green tolex
case "Chime Top Boost": return Color(red: 0.20, green: 0.32, blue: 0.20) // chime-green tolex
case "Neural Amp": return Color(red: 0.22, green: 0.16, blue: 0.30) // deep neural violet
case "Overdrive": return Color(red: 0.85, green: 0.42, blue: 0.08) // warm orange
case "Distortion": return Color(red: 0.80, green: 0.26, blue: 0.12) // hot rust
@@ -470,6 +470,14 @@ public struct PedalView: View {
/// Insets placing the ⓘ info button just under the top-left corner screw.
private static let infoButtonLeading: CGFloat = 5
private static let infoButtonTop: CGFloat = 20
/// Insets placing the advanced (gear) button just under the top-right corner screw, mirroring
/// the info button.
private static let advancedButtonTrailing: CGFloat = 5
private static let advancedButtonTop: CGFloat = 20
/// Layout of the advanced-controls pop-over: knobs per row and the inter-knob gap.
private static let advancedPopoverColumns: Int = 2
private static let advancedPopoverSpacing: CGFloat = 14
private static let advancedPopoverPadding: CGFloat = 16
private static let outerBorderLineWidth: CGFloat = 1.5
private static let innerHighlightLineWidth: CGFloat = 1
private static let innerHighlightPadding: CGFloat = 1
@@ -482,6 +490,9 @@ public struct PedalView: View {
/// Presentation flag for the pedal info panel (description + control ranges).
@State private var showInfo: Bool = false
/// Presentation flag for the advanced-controls pop-over (amp Sag / Bias / Bias X).
@State private var showAdvanced: Bool = false
/// Presentation flag for the Neural Amp model-file importer.
@State private var showModelImporter: Bool = false
@@ -559,6 +570,15 @@ public struct PedalView: View {
.padding(.leading, PedalView.infoButtonLeading)
.padding(.top, PedalView.infoButtonTop)
}
// Advanced (gear) button, tucked under the top-right corner screw — only for pedals that
// publish advanced knobs (e.g. an amp's Sag / Bias).
.overlay(alignment: .topTrailing) {
if !pedal.advancedKnobs.isEmpty {
advancedButton
.padding(.trailing, PedalView.advancedButtonTrailing)
.padding(.top, PedalView.advancedButtonTop)
}
}
.shadow(
color: Color.black.opacity(PedalView.shadowOpacity),
radius: PedalView.shadowRadius,
@@ -731,6 +751,46 @@ public struct PedalView: View {
.help("About this pedal")
}
/// Advanced-controls (gear) button tucked under the top-right corner screw. Presents
/// ``advancedPanel`` — the pedal's ``Pedal/advancedKnobs`` — in a popover. Only drawn when the
/// pedal publishes advanced knobs (the caller gates on `advancedKnobs.isEmpty`).
private var advancedButton: some View {
Button {
showAdvanced = true
} label: {
Image(systemName: "slider.horizontal.3")
.font(.system(size: PedalView.fontSizeNamePlate))
.foregroundStyle(Color.white.opacity(PedalView.infoButtonOpacity))
}
.buttonStyle(.plain)
.help("Advanced controls")
.popover(isPresented: $showAdvanced) {
advancedPanel
.presentationCompactAdaptation(.popover)
}
}
/// Grid of the pedal's ``Pedal/advancedKnobs`` shown in the advanced popover, laid out in rows of
/// ``advancedPopoverColumns``. Plain `ParameterKnob`s — these are live, non-topology controls.
private var advancedPanel: some View {
let knobs: [PedalKnob] = pedal.advancedKnobs
let columns: Int = PedalView.advancedPopoverColumns
let rows: [[PedalKnob]] = stride(from: 0, to: knobs.count, by: columns).map { startIndex in
Array(knobs[startIndex ..< min(startIndex + columns, knobs.count)])
}
return VStack(spacing: PedalView.advancedPopoverSpacing) {
ForEach(Array(rows.enumerated()), id: \.offset) { rowPair in
HStack(alignment: .top, spacing: PedalView.advancedPopoverSpacing) {
ForEach(Array(rowPair.element.enumerated()), id: \.offset) { knobPair in
ParameterKnob(knobPair.element.label, node: knobPair.element.node, range: knobPair.element.range)
.foregroundStyle(Color.white)
}
}
}
}
.padding(PedalView.advancedPopoverPadding)
}
/// Grid of the effect knobs, in rows of up to `knobColumnCount`.
///
/// The trailing `Mix` and `Level` knobs (the last two entries of `pedal.knobs`) are