// ShoeGazeState.swift // Lyrebird // // Copyright (c) 2026 Joshua Parmenter / realizedsound // SPDX-License-Identifier: MIT /// Format version written into every saved preset file. /// /// Increment this constant when the `ShoeGazeState` schema changes in a way that /// requires migration logic on load. public let presetFormatVersion: Int = 1 /// Serialisable snapshot of an entire `ShoeGaze` rig — all boards and their pedals. /// /// Use `ShoeGaze.saveRig(to:)` to write and `ShoeGaze.loadRig(from:)` to restore. /// The `version` field allows future migrations: loaders that read a file with a /// higher `version` than `presetFormatVersion` should reject or warn, while loaders /// reading older versions may apply forward-compatibility mappings. /// /// Unknown pedal types encountered during load are silently skipped so presets made /// with custom third-party pedals degrade gracefully on systems without those pedals. public struct ShoeGazeState: Codable, Equatable { /// Preset format version. Written as `presetFormatVersion` at save time. public let version: Int /// All board snapshots in the order they were created. public let boards: [BoardState] /// Creates a rig state snapshot. /// /// - Parameters: /// - version: Preset format version. Defaults to `presetFormatVersion`. /// - boards: Ordered list of board state snapshots. public init( version: Int = presetFormatVersion, boards: [BoardState] ) { self.version = version self.boards = boards } }