feat(audio): add audioDevices state + loadAudioDevices/setAudioOutputDevice
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
errorMessage,
|
||||
events,
|
||||
type AppSettings,
|
||||
type AudioDeviceInfo,
|
||||
type SyncTargetInfo,
|
||||
type SyncTargetConfig,
|
||||
type HardwareStatus,
|
||||
@@ -33,6 +34,7 @@ const DEFAULT_SETTINGS: AppSettings = {
|
||||
retention_max_size_gb: null,
|
||||
pst_last_path: null,
|
||||
pst_auto_sync: false,
|
||||
audio_output_device: null, // system default render device (FR-CAP-1)
|
||||
};
|
||||
|
||||
class SettingsStore {
|
||||
@@ -47,6 +49,7 @@ class SettingsStore {
|
||||
// Hardware + model management (Phase 3, T3.6/T3.7).
|
||||
hardware = $state<HardwareStatus | null>(null);
|
||||
models = $state<ModelInfo[]>([]);
|
||||
audioDevices = $state<AudioDeviceInfo[]>([]);
|
||||
downloadProgress = $state<Record<string, { received: number; total: number | null }>>({});
|
||||
|
||||
// Privacy self-check (T7.6, FR-SEC-2).
|
||||
@@ -71,6 +74,7 @@ class SettingsStore {
|
||||
this.backendStub = true;
|
||||
}
|
||||
await this.loadHardware();
|
||||
await this.loadAudioDevices();
|
||||
await this.loadModels();
|
||||
await this.loadPrivacy();
|
||||
await this.loadLlmStatus();
|
||||
@@ -125,6 +129,18 @@ class SettingsStore {
|
||||
}
|
||||
}
|
||||
|
||||
async loadAudioDevices() {
|
||||
try {
|
||||
this.audioDevices = await api.listAudioDevices();
|
||||
} catch {
|
||||
this.audioDevices = [];
|
||||
}
|
||||
}
|
||||
|
||||
async setAudioOutputDevice(deviceId: string | null) {
|
||||
await this.patch({ audio_output_device: deviceId });
|
||||
}
|
||||
|
||||
async loadModels() {
|
||||
try {
|
||||
this.models = await api.listModels();
|
||||
|
||||
Reference in New Issue
Block a user