fix(amps): recall rebuilds on a rebuildsOnChange switch (channel)

Review blocker: lightweight recall (ShoeGaze.applyState) detected topology change
only via Pedal.rebuildSelectorValues (effectSelectors), so a channel switch —
the first rebuildsOnChange *switch* — flipped during a scene recall wrote the
node value but never rebuilt, leaving the stale channel topology (wrong preamp).

- Rename/extend to Pedal.rebuildTopologyValues: folds in effectSwitches flagged
  rebuildsOnChange alongside the selectors (both NaN-sanitized). Recall call sites
  in ShoeGaze+Preset updated.
- FullertonDrive: rename channel constants to generic switchOff/On (used by the
  Bright switch too).
- Test: applyStateRebuildsBoardWhenChannelSwitchChanges — recall flipping the
  channel rebuilds the board and applies the recalled channel.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-03 13:10:23 -07:00
parent da4d5e23ea
commit e88db04686
4 changed files with 51 additions and 16 deletions
@@ -391,9 +391,9 @@ extension ShoeGaze {
switch (segment, segmentState) {
case let (.pedal(pedal), .pedal(pedalState)):
if pedal.displayName == pedalState.type {
let before: [Double] = pedal.rebuildSelectorValues
let before: [Double] = pedal.rebuildTopologyValues
pedal.applyState(pedalState)
if pedal.rebuildSelectorValues != before { topologyChanged = true }
if pedal.rebuildTopologyValues != before { topologyChanged = true }
}
case let (.parallel(section), .parallel(parallelState)):
@@ -429,9 +429,9 @@ extension ShoeGaze {
private func applyBranchParams(_ states: [PedalState], to pedals: [Pedal]) -> Bool {
var topologyChanged: Bool = false
for (pedal, pedalState) in zip(pedals, states) where pedal.displayName == pedalState.type {
let before: [Double] = pedal.rebuildSelectorValues
let before: [Double] = pedal.rebuildTopologyValues
pedal.applyState(pedalState)
if pedal.rebuildSelectorValues != before { topologyChanged = true }
if pedal.rebuildTopologyValues != before { topologyChanged = true }
}
return topologyChanged
}