Release 2.0.0: metronome, rig mute + shortcuts, set-list ordering, per-rig persistence
- Visual metronome tempo indicator (pendulum playhead) replacing the flashing LED - Rig Mute (Cmd-Z) hard-silence, distinct from Bypass Rig; wired to header, board menu, MIDI - Keyboard shortcuts: Cmd-1..9 board switch, Cmd-Shift-1..0 set-list rig load, Cmd-Z mute (macOS native menus + iOS/iPadOS hardware keyboards) - Rig set-list ordering: drag or Move Up/Down in the picker; order saved and archive-portable - Persist tempo, input selection, and engine I/O with a rig (I/O applied via opt-in applyChannelLayout, not forced on load) - Fix archive import colliding set-list positions with existing rigs - Remove ShoeGazeDemo / ShoeGazeiOSDemo apps and projects; keep the two Builder apps - Bump marketing version to 2.0.0 on both Builder projects; pin Lyrebird 1.2.3 - Add CHANGELOG.md Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -316,6 +316,138 @@ struct PresetTests {
|
||||
#expect(abs(driveValue - 12.0) < 1e-9, "drive knob value should be 12.0, got \(driveValue)")
|
||||
}
|
||||
|
||||
// MARK: - Tempo & input persistence
|
||||
|
||||
@Test func tempoAndInputSettingsRoundTripThroughFile() throws {
|
||||
let (sg, _, url): (ShoeGaze, SynthesisEngine, URL) = try makeTwoBoardRig()
|
||||
defer { try? FileManager.default.removeItem(at: url) }
|
||||
let presetURL: URL = FileManager.default.temporaryDirectory
|
||||
.appendingPathComponent(UUID().uuidString + ".json")
|
||||
defer { try? FileManager.default.removeItem(at: presetURL) }
|
||||
|
||||
// Save a distinctive tempo + disabled tempo features (input stays on the test loop).
|
||||
let savedBpm: Double = 132.0
|
||||
sg.clock.bpm = savedBpm
|
||||
sg.setTempoEnabled(false)
|
||||
try sg.saveRig(to: presetURL)
|
||||
|
||||
// Drift the live values away from what was saved, then confirm the reload restores them.
|
||||
sg.clock.bpm = 90.0
|
||||
sg.setTempoEnabled(true)
|
||||
|
||||
try sg.loadRig(from: presetURL)
|
||||
#expect(abs(sg.clock.bpm - savedBpm) < 1e-9, "bpm should restore to \(savedBpm)")
|
||||
#expect(sg.tempoEnabled == false, "tempoEnabled should restore to false")
|
||||
#expect(sg.inputSource == .testLoop, "input source should restore to test loop")
|
||||
}
|
||||
|
||||
@Test func liveInputSourcePersistsAndFallsBackWhenChannelMissing() throws {
|
||||
// Engine WITH an input channel: a live-input rig round-trips its source.
|
||||
let (engineIn, urlIn): (SynthesisEngine, URL) = makeNRTEngine(
|
||||
duration: 0.1,
|
||||
numInputChannels: 1,
|
||||
numAudioBuses: 128
|
||||
)
|
||||
defer { try? FileManager.default.removeItem(at: urlIn) }
|
||||
let sgIn: ShoeGaze = ShoeGaze(engine: engineIn, inputSource: .liveInput(channel: 0))
|
||||
let board: PedalBoard = try sgIn.addBoard()
|
||||
try board.add(OverdrivePedal())
|
||||
try sgIn.finalizeBoard(board)
|
||||
|
||||
let state: ShoeGazeState = sgIn.captureState()
|
||||
#expect(state.inputSource == .liveInput(channel: 0), "capture should record the live input")
|
||||
|
||||
// Reload into the same input-capable engine: source preserved.
|
||||
try sgIn.loadRig(from: state)
|
||||
#expect(sgIn.inputSource == .liveInput(channel: 0), "live input should round-trip")
|
||||
|
||||
// loadRig does NOT auto-apply the saved channel layout, so loading into an engine with no
|
||||
// input channels falls back to the test loop rather than clobbering the engine's config.
|
||||
let (engineNoIn, urlNoIn): (SynthesisEngine, URL) = makeNRTEngine(
|
||||
duration: 0.1,
|
||||
numInputChannels: 0,
|
||||
numAudioBuses: 128
|
||||
)
|
||||
defer { try? FileManager.default.removeItem(at: urlNoIn) }
|
||||
let sgNoIn: ShoeGaze = ShoeGaze(engine: engineNoIn)
|
||||
try sgNoIn.loadRig(from: state)
|
||||
#expect(engineNoIn.numInputChannels == 0, "loadRig must not reconfigure the engine's I/O")
|
||||
#expect(sgNoIn.inputSource == .testLoop, "missing channel should fall back to test loop")
|
||||
}
|
||||
|
||||
@Test func channelCountsPersistButLoadDoesNotReconfigure() throws {
|
||||
// Capture a rig on an engine with 1 input / 2 output channels: the counts are recorded and
|
||||
// survive a JSON round-trip.
|
||||
let (engineA, urlA): (SynthesisEngine, URL) = makeNRTEngine(
|
||||
duration: 0.1,
|
||||
numOutputChannels: 2,
|
||||
numInputChannels: 1,
|
||||
numAudioBuses: 128
|
||||
)
|
||||
defer { try? FileManager.default.removeItem(at: urlA) }
|
||||
let sgA: ShoeGaze = ShoeGaze(engine: engineA)
|
||||
let boardA: PedalBoard = try sgA.addBoard()
|
||||
try boardA.add(OverdrivePedal())
|
||||
try sgA.finalizeBoard(boardA)
|
||||
|
||||
let state: ShoeGazeState = sgA.captureState()
|
||||
#expect(state.numInputChannels == 1)
|
||||
#expect(state.numOutputChannels == 2)
|
||||
let decoded: ShoeGazeState = try JSONDecoder().decode(
|
||||
ShoeGazeState.self, from: JSONEncoder().encode(state)
|
||||
)
|
||||
#expect(decoded.numInputChannels == 1)
|
||||
#expect(decoded.numOutputChannels == 2)
|
||||
|
||||
// Loading the rig must NOT reconfigure the destination engine's channel layout.
|
||||
let (engineB, urlB): (SynthesisEngine, URL) = makeNRTEngine(
|
||||
duration: 0.1,
|
||||
numOutputChannels: 2,
|
||||
numInputChannels: 0,
|
||||
numAudioBuses: 128
|
||||
)
|
||||
defer { try? FileManager.default.removeItem(at: urlB) }
|
||||
let sgB: ShoeGaze = ShoeGaze(engine: engineB)
|
||||
try sgB.loadRig(from: state)
|
||||
#expect(engineB.numInputChannels == 0, "loadRig must leave engine I/O untouched")
|
||||
}
|
||||
|
||||
@Test func applyChannelLayoutReconfiguresEngineToSavedCounts() throws {
|
||||
// The deliberate opt-in DOES reconfigure the engine to a rig's saved channel layout.
|
||||
let (engineA, urlA): (SynthesisEngine, URL) = makeNRTEngine(
|
||||
duration: 0.1,
|
||||
numOutputChannels: 2,
|
||||
numInputChannels: 1,
|
||||
numAudioBuses: 128
|
||||
)
|
||||
defer { try? FileManager.default.removeItem(at: urlA) }
|
||||
let sgA: ShoeGaze = ShoeGaze(engine: engineA)
|
||||
let boardA: PedalBoard = try sgA.addBoard()
|
||||
try boardA.add(OverdrivePedal())
|
||||
try sgA.finalizeBoard(boardA)
|
||||
let state: ShoeGazeState = sgA.captureState()
|
||||
|
||||
let (engineB, urlB): (SynthesisEngine, URL) = makeNRTEngine(
|
||||
duration: 0.1,
|
||||
numOutputChannels: 2,
|
||||
numInputChannels: 0,
|
||||
numAudioBuses: 128
|
||||
)
|
||||
defer { try? FileManager.default.removeItem(at: urlB) }
|
||||
let sgB: ShoeGaze = ShoeGaze(engine: engineB)
|
||||
try sgB.loadRig(from: state)
|
||||
#expect(engineB.numInputChannels == 0, "load alone leaves I/O untouched")
|
||||
|
||||
let changed: Bool = try sgB.applyChannelLayout(from: state)
|
||||
#expect(changed, "applyChannelLayout should report a change")
|
||||
#expect(engineB.numInputChannels == 1, "opt-in apply reconfigures to the saved input count")
|
||||
#expect(engineB.numOutputChannels == 2)
|
||||
|
||||
// Idempotent: applying again with matching counts is a no-op.
|
||||
let changedAgain: Bool = try sgB.applyChannelLayout(from: state)
|
||||
#expect(!changedAgain, "no reconfigure when counts already match")
|
||||
}
|
||||
|
||||
// MARK: - Save / Load via temp file
|
||||
|
||||
@Test func saveRigAndLoadRigRestoresKnobValues() throws {
|
||||
|
||||
Reference in New Issue
Block a user