From 996c7edc995bf41085963ebfd6a341254d7ea8ba Mon Sep 17 00:00:00 2001 From: iamdoubz <> Date: Mon, 6 Jul 2026 16:26:24 -0500 Subject: [PATCH] feat(audio): load input devices + setMicrophone in settings store (FR-CAP-7) --- src/lib/stores/settings.svelte.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/lib/stores/settings.svelte.ts b/src/lib/stores/settings.svelte.ts index 13853e8..bd3b0e9 100644 --- a/src/lib/stores/settings.svelte.ts +++ b/src/lib/stores/settings.svelte.ts @@ -35,6 +35,8 @@ const DEFAULT_SETTINGS: AppSettings = { pst_last_path: null, pst_auto_sync: false, audio_output_device: null, // system default render device (FR-CAP-1) + microphone_enabled: true, // capture the user's mic into the transcript (FR-CAP-7) + audio_input_device: null, // system default capture device }; class SettingsStore { @@ -50,6 +52,7 @@ class SettingsStore { hardware = $state(null); models = $state([]); audioDevices = $state([]); + inputDevices = $state([]); downloadProgress = $state>({}); // Privacy self-check (T7.6, FR-SEC-2). @@ -75,6 +78,7 @@ class SettingsStore { } await this.loadHardware(); await this.loadAudioDevices(); + await this.loadInputDevices(); await this.loadModels(); await this.loadPrivacy(); await this.loadLlmStatus(); @@ -141,6 +145,20 @@ class SettingsStore { await this.patch({ audio_output_device: deviceId }); } + async loadInputDevices() { + try { + this.inputDevices = await api.listInputDevices(); + } catch { + this.inputDevices = []; + } + } + + /** Set the microphone selection in one patch (FR-CAP-7): `enabled=false` + * disables mic capture entirely; `deviceId=null` uses the system default. */ + async setMicrophone(enabled: boolean, deviceId: string | null) { + await this.patch({ microphone_enabled: enabled, audio_input_device: deviceId }); + } + async loadModels() { try { this.models = await api.listModels();