diff --git a/Sources/LyrebirdShoeGazeUI/EngineConfigView.swift b/Sources/LyrebirdShoeGazeUI/EngineConfigView.swift index c40414a..d96e8c6 100644 --- a/Sources/LyrebirdShoeGazeUI/EngineConfigView.swift +++ b/Sources/LyrebirdShoeGazeUI/EngineConfigView.swift @@ -113,6 +113,16 @@ public struct EngineConfigView: View { } message: { Text(alertText) } + // Resync the pending fields whenever the engine is rebuilt out from under this view (e.g. + // the iOS live-input rebuild swaps in a new engine with a different input-channel count). + // Keyed on the engine's object identity so it re-runs on every swap; the @State initial + // values are seeded only once, so without this the stepper would keep showing the old + // engine's channel counts even though audio reads the new one. + .task(id: ObjectIdentifier(shoeGaze.engine)) { + pendingSampleRate = shoeGaze.engine.sampleRate + pendingInputs = shoeGaze.engine.numInputChannels + pendingOutputs = shoeGaze.engine.numOutputChannels + } } private func label(_ text: String) -> some View {