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
@@ -20,6 +20,7 @@ extension Pedal {
let switchValues: [Double] = effectSwitches.map { $0.node.value }
let sliderValues: [Double] = effectSliders.map { $0.node.value }
let selectorValues: [Double] = effectSelectors.map { $0.node.value }
let advancedValues: [Double] = advancedKnobs.map { $0.node.value }
return PedalState(
id: id,
type: displayName,
@@ -27,6 +28,7 @@ extension Pedal {
switchValues: switchValues,
sliderValues: sliderValues,
selectorValues: selectorValues,
advancedValues: advancedValues,
bypass: bypass,
tempoSync: tempoSync.isEmpty ? nil : tempoSync,
resourcePath: resourcePath
@@ -62,6 +64,9 @@ extension Pedal {
for (selector, value) in zip(effectSelectors, state.selectorValues) {
selector.node.update(value)
}
for (advancedKnob, value) in zip(advancedKnobs, state.advancedValues) {
advancedKnob.node.update(value)
}
bypass = state.bypass
// Restore tempo-sync state. The synced values themselves are recomputed from the rig's
// tempo by `ShoeGaze` after the rebuild, so no clock is required here.
@@ -53,7 +53,7 @@ public enum PedalRegistry {
"Chime Baby": { ChimeBabyAmpPedal() },
"Fullerton Reverb": { FullertonReverbAmpPedal() },
"Fullerton Deluxe": { FullertonDeluxeAmpPedal() },
"Fullerton Princeton": { FullertonPrincetonAmpPedal() },
"Fullerton Ivy League": { FullertonPrincetonAmpPedal() },
"Fullerton Drive": { FullertonDriveAmpPedal() },
"Jazz Clean": { JazzCleanAmpPedal() },
"Chime Top Boost": { ChimeTopBoostAmpPedal() },
@@ -42,6 +42,10 @@ public struct PedalState: Codable, Equatable {
/// no selectors. Absent in presets saved before selectors existed — decodes to `[]`.
public let selectorValues: [Double]
/// Advanced (pop-over) knob values in the same order as `Pedal.advancedKnobs`. Empty for pedals
/// with no advanced knobs. Absent in presets saved before advanced knobs existed — decodes to `[]`.
public let advancedValues: [Double]
/// Bypass parameter value. `0.0` = engaged, `1.0` = bypassed.
public let bypass: Double
@@ -62,6 +66,7 @@ public struct PedalState: Codable, Equatable {
/// - switchValues: Current switch values in `Pedal.effectSwitches` order. Defaults to empty.
/// - sliderValues: Current slider values in `Pedal.effectSliders` order. Defaults to empty.
/// - selectorValues: Current selector values in `Pedal.effectSelectors` order. Defaults to empty.
/// - advancedValues: Current advanced-knob values in `Pedal.advancedKnobs` order. Defaults to empty.
/// - bypass: Bypass parameter value (`0.0` = engaged, `1.0` = bypassed).
/// - tempoSync: Tempo-sync state per syncable parameter, or `nil` for none. Defaults to `nil`.
/// - resourcePath: Path to an external resource the pedal references (e.g. a neural-amp
@@ -73,6 +78,7 @@ public struct PedalState: Codable, Equatable {
switchValues: [Double] = [],
sliderValues: [Double] = [],
selectorValues: [Double] = [],
advancedValues: [Double] = [],
bypass: Double,
tempoSync: [String: TempoSync]? = nil,
resourcePath: String? = nil
@@ -83,6 +89,7 @@ public struct PedalState: Codable, Equatable {
self.switchValues = switchValues
self.sliderValues = sliderValues
self.selectorValues = selectorValues
self.advancedValues = advancedValues
self.bypass = bypass
self.tempoSync = tempoSync
self.resourcePath = resourcePath
@@ -95,13 +102,14 @@ public struct PedalState: Codable, Equatable {
case switchValues
case sliderValues
case selectorValues
case advancedValues
case bypass
case tempoSync
case resourcePath
}
/// Decodes a snapshot, tolerating presets saved before `switchValues` / `sliderValues` /
/// `selectorValues` / `tempoSync` existed by defaulting the missing keys.
/// `selectorValues` / `advancedValues` / `tempoSync` existed by defaulting the missing keys.
public init(from decoder: any Decoder) throws {
let container: KeyedDecodingContainer<CodingKeys> = try decoder.container(keyedBy: CodingKeys.self)
self.id = try container.decodeIfPresent(UUID.self, forKey: .id) ?? UUID()
@@ -110,6 +118,7 @@ public struct PedalState: Codable, Equatable {
self.switchValues = try container.decodeIfPresent([Double].self, forKey: .switchValues) ?? []
self.sliderValues = try container.decodeIfPresent([Double].self, forKey: .sliderValues) ?? []
self.selectorValues = try container.decodeIfPresent([Double].self, forKey: .selectorValues) ?? []
self.advancedValues = try container.decodeIfPresent([Double].self, forKey: .advancedValues) ?? []
self.bypass = try container.decode(Double.self, forKey: .bypass)
self.tempoSync = try container.decodeIfPresent([String: TempoSync].self, forKey: .tempoSync)
self.resourcePath = try container.decodeIfPresent(String.self, forKey: .resourcePath)