diff --git a/Sources/LyrebirdShoeGaze/Presets/Pedal+Preset.swift b/Sources/LyrebirdShoeGaze/Presets/Pedal+Preset.swift index 29a358d..b1d89f2 100644 --- a/Sources/LyrebirdShoeGaze/Presets/Pedal+Preset.swift +++ b/Sources/LyrebirdShoeGaze/Presets/Pedal+Preset.swift @@ -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