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
@@ -44,7 +44,7 @@ public enum PedalCategory: String, CaseIterable, Identifiable, Sendable {
}
private static let mapping: [String: PedalCategory] = [
"California": .amp, "British": .amp, "British Plexi": .amp, "British JTM": .amp, "British Bluesbreaker": .amp, "British Master": .amp, "British Dual": .amp, "Boutique Lead": .amp, "Boutique OD": .amp, "Cali Hi-Gain": .amp, "Command": .amp, "Citrus": .amp, "Sixties Combo": .amp, "Magna Vibrato": .amp, "Anaheim": .amp, "Modern High-Gain": .amp, "Chime": .amp, "Chime 15": .amp, "Chime Normal": .amp, "Chime Baby": .amp, "Fullerton Reverb": .amp, "Fullerton Deluxe": .amp, "Fullerton Princeton": .amp, "Fullerton Drive": .amp, "Jazz Clean": .amp, "Chime Top Boost": .amp, "Neural Amp": .amp,
"California": .amp, "British": .amp, "British Plexi": .amp, "British JTM": .amp, "British Bluesbreaker": .amp, "British Master": .amp, "British Dual": .amp, "Boutique Lead": .amp, "Boutique OD": .amp, "Cali Hi-Gain": .amp, "Command": .amp, "Citrus": .amp, "Sixties Combo": .amp, "Magna Vibrato": .amp, "Anaheim": .amp, "Modern High-Gain": .amp, "Chime": .amp, "Chime 15": .amp, "Chime Normal": .amp, "Chime Baby": .amp, "Fullerton Reverb": .amp, "Fullerton Deluxe": .amp, "Fullerton Ivy League": .amp, "Fullerton Drive": .amp, "Jazz Clean": .amp, "Chime Top Boost": .amp, "Neural Amp": .amp,
"Overdrive": .gain, "Distortion": .gain, "Fuzz": .gain, "Volume": .gain,
"Compressor": .dynamics, "Sustainer": .dynamics, "Limiter": .dynamics, "Noise Gate": .dynamics,
"Graphic EQ": .filter, "Auto-Wah": .filter, "Wah": .filter, "Mutant": .filter,
@@ -54,7 +54,7 @@ public struct PedalPaletteView: View {
/// Preferred display order for the built-in pedals. Any registered pedal not listed here is
/// appended afterwards (sorted) so the palette never silently drops a newly added pedal.
private static let preferredOrder: [String] = [
"California", "British", "British Plexi", "British JTM", "British Bluesbreaker", "British Master", "British Dual", "Boutique Lead", "Boutique OD", "Cali Hi-Gain", "Command", "Citrus", "Sixties Combo", "Magna Vibrato", "Anaheim", "Modern High-Gain", "Chime", "Chime 15", "Chime Normal", "Chime Baby", "Fullerton Reverb", "Fullerton Deluxe", "Fullerton Princeton", "Fullerton Drive", "Jazz Clean", "Chime Top Boost", "Overdrive", "Distortion", "Compressor", "Sustainer", "Limiter", "Noise Gate", "Fuzz",
"California", "British", "British Plexi", "British JTM", "British Bluesbreaker", "British Master", "British Dual", "Boutique Lead", "Boutique OD", "Cali Hi-Gain", "Command", "Citrus", "Sixties Combo", "Magna Vibrato", "Anaheim", "Modern High-Gain", "Chime", "Chime 15", "Chime Normal", "Chime Baby", "Fullerton Reverb", "Fullerton Deluxe", "Fullerton Ivy League", "Fullerton Drive", "Jazz Clean", "Chime Top Boost", "Overdrive", "Distortion", "Compressor", "Sustainer", "Limiter", "Noise Gate", "Fuzz",
"Volume",
"Graphic EQ", "Tremolo", "Phaser", "Modulation", "Chorus", "Flanger", "Vibrato", "Rotary",
"Auto-Wah", "Wah", "Mutant", "Cabinet", "Ring Modulator", "Diffuser", "Bitcrusher", "Granulator",
@@ -183,6 +183,12 @@ public struct PedalPaletteView: View {
/// Full-width column for a left sidebar.
private var verticalBody: some View {
VStack(alignment: .leading, spacing: PedalPaletteView.sectionSpacing) {
VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) {
sectionTitle("ROUTING")
ForEach(PedalPaletteView.routingOptions, id: \.title) { option in
routingCard(title: option.title, caption: option.caption, action: option.action)
}
}
VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) {
HStack {
sectionTitle("PEDALS")
@@ -193,13 +199,6 @@ public struct PedalPaletteView: View {
pedalRow(name)
}
}
VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) {
sectionTitle("ROUTING")
ForEach(PedalPaletteView.routingOptions, id: \.title) { option in
routingCard(title: option.title, caption: option.caption, action: option.action)
}
}
}
}
@@ -225,6 +224,14 @@ public struct PedalPaletteView: View {
}
}
HStack(alignment: .top, spacing: PedalPaletteView.sectionSpacing) {
VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) {
sectionTitle("ROUTING")
HStack(alignment: .top, spacing: PedalPaletteView.rowSpacing) {
ForEach(PedalPaletteView.routingOptions, id: \.title) { option in
routingCard(title: option.title, caption: option.caption, action: option.action)
}
}
}
if let amps: (category: PedalCategory, names: [String]) = ampGroup {
VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) {
categoryLabel(amps.category)
@@ -235,14 +242,6 @@ public struct PedalPaletteView: View {
}
}
}
VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) {
sectionTitle("ROUTING")
HStack(alignment: .top, spacing: PedalPaletteView.rowSpacing) {
ForEach(PedalPaletteView.routingOptions, id: \.title) { option in
routingCard(title: option.title, caption: option.caption, action: option.action)
}
}
}
}
}
}
+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