# 2.1.1 — Input mute + I/O persistence Two small, related fixes to cut down accidental noise at engine start and make the input configuration survive relaunch. ## (a) Input mute toggle A hard mute on the **input** feeding every board (the guitar / mic signal), distinct from the existing rig-**output** mute. Goals: - Defaults **muted**, and is **re-asserted muted every time the engine is (user-)started**, so a fresh start is silent until the player un-mutes — kills accidental ruckus. - A toggle button sits **next to the Start/Stop transport**. - **MIDI mappable** (Program Change + computer key), like Rig Mute. - Also default the input source to **In 0** (live input) instead of the test-loop arpeggio. ### RT graph Each board's input writer (`TestLoopTap` in test-loop mode, `HardwareInputPassThrough` in live mode) gains an `@UIParam inputMute` (0 = audible, 1 = muted). `build()` multiplies the copied signal by a lagged mute gain (20 ms, click-free), mirroring `BoardOutputMaster.rigOutputGainStage()`. ### ShoeGaze - `public private(set) var inputMuted: Bool = true` - `setInputMuted(_:)` drives every `testLoopTaps` + `inputPassThroughs` mute node; `toggleInputMuted()`. - `addBoard()` sets each new input node's mute to the current `inputMuted` so rebuilds stay consistent. ### Engine start `EngineConfigView.startEngine()` calls `shoeGaze.setInputMuted(true)` after a successful user Start. Transient stop/start-around-rebuild paths (`applyInputSource`, `performClear`) call `engine.start()` directly and are unaffected — they preserve the current mute state. ### MIDI - `MIDIMap.Action.inputMute` - `MIDIController.perform` → `toggleInputMuted()`; `hint` → nil. - `MIDIMappingSheet` switch row "Input Mute". ### Default to In 0 `ShoeGazeBuilderView.restoreInputSelection()` first-launch (no saved choice) branch requests mic access and selects `.liveInput(channel: 0)` (falling back to test loop on denial / no input), instead of only auto-selecting when already authorised. ## (b) Persist In/Out channel counts (+ reliable last-input) The last-used input **selection** already persists (`ShoeGaze.inputSelection`), but the engine's **channel counts** do not — so on relaunch the engine reverts to the app default (1 in / 2 out). A saved input channel `>=` the smaller default count then fails validation and silently falls back to the test loop. That is the "In doesn't persist" bug. Fix: persist the channel counts too. - WRITE: `EngineConfigView` persists `pendingInputs` / `pendingOutputs` to UserDefaults (`ShoeGaze.inputChannels` / `ShoeGaze.outputChannels`) whenever they change while stopped. - READ/APPLY at launch, where the engine is actually constructed: - macOS `AppDelegate`: seed `numInputChannels` / `numOutputChannels` from the saved values (fallback 1 / 2). - iOS `ShoeGazeBuilderiOSAppModel`: seed `numOutputChannels` from saved (fallback 2). Input stays on the existing permission-gated rebuild flow. Key strings are duplicated in the app targets with a "must match" comment, matching the existing convention for `inputSelectionDefaultsKey`. ## Tests - `InputMuteTests` — `HardwareInputPassThrough` / `TestLoopTap` mute gain; `ShoeGaze.setInputMuted` drives all input nodes; `addBoard` brings a new board up at the current mute state. - `MIDIController` — an `inputMute` switch action toggles `shoeGaze.inputMuted`.