From 652a5a76cabc99667e016c21d0570d962ff8c13e Mon Sep 17 00:00:00 2001 From: Joshua Parmenter Date: Tue, 23 Jun 2026 21:10:13 -0700 Subject: [PATCH] Default iOS builder to one input channel Construct the iOS engine with one input channel by default so live input is available immediately and the In: stepper reads 1. Trade-off: iOS prompts for microphone access at the first Start even while input defaults to test loop. The permission-gated enableLiveInput() rebuild stays in place for any future input-less configuration. Co-Authored-By: Claude Opus 4.8 --- .../ShoeGazeBuilderiOSAppModel.swift | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Demo/ShoeGazeBuilderiOS/ShoeGazeBuilderiOSAppModel.swift b/Demo/ShoeGazeBuilderiOS/ShoeGazeBuilderiOSAppModel.swift index 129ba3c..32c4fc3 100644 --- a/Demo/ShoeGazeBuilderiOS/ShoeGazeBuilderiOSAppModel.swift +++ b/Demo/ShoeGazeBuilderiOS/ShoeGazeBuilderiOSAppModel.swift @@ -24,11 +24,12 @@ final class ShoeGazeBuilderiOSAppModel { private static let blockSize: Int = 512 private static let outputChannels: Int = 2 - // Kept at 0: with input channels the iOS driver switches the session to `.playAndRecord` - // and enables the RemoteIO input element, which makes iOS prompt for microphone access at - // engine start even in test-loop mode. iOS live input needs a permission-gated engine - // rebuild (request mic → reconstruct the engine with an input channel) before it can be - // enabled here without that surprise prompt. + // Default to one input channel so live input is available immediately. The trade-off is + // that the iOS driver runs a `.playAndRecord` session with the RemoteIO input element + // enabled, so iOS prompts for microphone access at the first Start even while the input + // still defaults to `.testLoop`. (The permission-gated `enableLiveInput()` rebuild remains + // available for any future build that starts input-less.) + private static let inputChannels: Int = 1 private static let numAudioBuses: Int = 256 private static let seedPedalType: String = "Overdrive" @@ -55,7 +56,7 @@ final class ShoeGazeBuilderiOSAppModel { init() { ShoeGazeBuilderiOSAppModel.configureAudioSession() let built: (engine: SynthesisEngine, driver: iOSAudioDriver, shoeGaze: ShoeGaze) = - ShoeGazeBuilderiOSAppModel.buildEngine(inputChannels: 0) + ShoeGazeBuilderiOSAppModel.buildEngine(inputChannels: ShoeGazeBuilderiOSAppModel.inputChannels) self.engine = built.engine self.iosDriver = built.driver self.shoeGaze = built.shoeGaze