docs(preset): reattach applyState doc above its declaration

The legacy-migration fix spliced private declarations between applyState's
doc comment and the method, so the doc silently reattached to the private
modernHighGainType constant. Move it back above applyState (and note the
legacyMigrated normalization + advanced-knob restore). Caught in re-review.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-03 21:26:35 -07:00
parent 781577b062
commit 9c0122f199
@@ -35,19 +35,6 @@ extension Pedal {
)
}
/// Applies a previously captured `PedalState` to this pedal's parameters.
///
/// For each (knob, value) pair in `zip(knobs, state.knobValues)`, the knob's
/// `UIParamNode` is updated via `node.update(_:)`; switch positions are restored the
/// same way from `zip(effectSwitches, state.switchValues)`. If either array has fewer
/// entries than its controls, the trailing controls retain their current values; extra
/// values are ignored. The `bypass` parameter is always applied regardless of any
/// count mismatch. Presets saved before switches existed carry an empty
/// `switchValues`, leaving switch positions at their defaults.
///
/// - Parameter state: The state to restore. The `state.type` is not validated
/// against `displayName` — the caller is responsible for matching types before
/// calling this method.
/// Modern High-Gain's display name — the one shipped amp whose `Sag` control started life as a
/// face knob and later moved to the advanced pop-over. Used to detect its legacy `PedalState`
/// layout in ``legacyMigrated(_:)``.
@@ -95,6 +82,18 @@ extension Pedal {
)
}
/// Applies a previously captured `PedalState` to this pedal's parameters.
///
/// The incoming state is first normalized by ``legacyMigrated(_:)`` for older on-disk layouts.
/// For each (knob, value) pair in `zip(knobs, state.knobValues)`, the knob's `UIParamNode` is
/// updated via `node.update(_:)`; switch, slider, selector, and advanced-knob positions are
/// restored the same way. If either array has fewer entries than its controls, the trailing
/// controls retain their current values; extra values are ignored. The `bypass` parameter is
/// always applied regardless of any count mismatch. Presets saved before a given control existed
/// carry an empty array for it, leaving those controls at their defaults.
///
/// - Parameter rawState: The state to restore. The `state.type` is not validated against
/// `displayName` — the caller is responsible for matching types before calling this method.
public func applyState(_ rawState: PedalState) {
let state: PedalState = Pedal.legacyMigrated(rawState)
// Restore the saved identity so the pedal keeps its id across rebuilds; MIDI bindings