fix(cab): NaN-safe selector compare; correct applyState doc contract
Re-review follow-ups: - rebuildSelectorValues sanitizes non-finite node values to a sentinel so the before/after recall compare (uses !=) can't be forced true by NaN != NaN, which would trigger a needless rebuild on every recall. - ShoeGaze.applyState doc no longer claims "without rebuilding the engine graph": it now documents that a board is rebuilt (with the one-block-glitch caveat) when a rebuildsOnChange selector value differs from the live rig. Iteration-during-mutation in applyState confirmed safe: zip over the stored [PedalBoard] array snapshots it (COW), and PedalBoard is a final class, so rebuildBoard mutating self.boards mid-loop does not disturb the iteration. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -334,8 +334,8 @@ extension ShoeGaze {
|
||||
|
||||
// MARK: - Lightweight recall
|
||||
|
||||
/// Applies parameter values from `state` to the current rig topology without
|
||||
/// rebuilding the engine graph.
|
||||
/// Applies parameter values from `state` to the current rig topology, rebuilding only the
|
||||
/// boards where a graph-topology selector changed.
|
||||
///
|
||||
/// This is a lightweight "recall settings" path intended for topologically identical
|
||||
/// rigs (same board count, same segment order, same pedal types). Boards, segments, and
|
||||
@@ -345,6 +345,12 @@ extension ShoeGaze {
|
||||
/// is thrown and remaining
|
||||
/// entries continue to be processed.
|
||||
///
|
||||
/// Most parameters apply live with no graph change. The exception is a `rebuildsOnChange`
|
||||
/// selector (e.g. a cabinet voice, which picks which convolver is instantiated): if such a
|
||||
/// selector's value differs from the live rig, that board is rebuilt via `rebuildBoard(_:from:)`
|
||||
/// so the new selection takes effect — which carries the same at-most-one-block glitch as any
|
||||
/// rebuild on a running engine. Boards without such a selector stay fully live.
|
||||
///
|
||||
/// Use `loadRig(from:)` when you need a full topology rebuild.
|
||||
///
|
||||
/// - Parameter state: The `ShoeGazeState` whose parameter values should be applied.
|
||||
|
||||
Reference in New Issue
Block a user