feat(audio): add v2 commands for quality fallback behavior

v2_get_quality_fallback_behavior and v2_set_quality_fallback_behavior
to read/write the persisted user preference.

cc
This commit is contained in:
victorrhgap committed 2026-03-25 14:06:21 -06:00
1 parent 038f846884
commit 94518e56c2
2 files changed
+38

No files matched your search

+36
View File
@@ -8674,6 +8674,42 @@ pub fn v2_set_sync_audio_on_startup(
.map_err(RuntimeError::Internal)
}
/// Get quality fallback behavior (V2)
#[tauri::command]
pub fn v2_get_quality_fallback_behavior(
audio_settings: State<'_, AudioSettingsState>,
) -> Result<String, RuntimeError> {
let guard = audio_settings
.store
.lock()
.map_err(|e| RuntimeError::Internal(format!("Lock error: {}", e)))?;
let store = guard
.as_ref()
.ok_or(RuntimeError::UserSessionNotActivated)?;
store
.get_quality_fallback_behavior()
.map_err(RuntimeError::Internal)
}
/// Set quality fallback behavior (V2)
#[tauri::command]
pub fn v2_set_quality_fallback_behavior(
behavior: String,
audio_settings: State<'_, AudioSettingsState>,
) -> Result<(), RuntimeError> {
log::info!("Command: v2_set_quality_fallback_behavior {}", behavior);
let guard = audio_settings
.store
.lock()
.map_err(|e| RuntimeError::Internal(format!("Lock error: {}", e)))?;
let store = guard
.as_ref()
.ok_or(RuntimeError::UserSessionNotActivated)?;
store
.set_quality_fallback_behavior(&behavior)
.map_err(RuntimeError::Internal)
}
/// Set preferred sample rate (V2)
#[tauri::command]
pub async fn v2_set_audio_sample_rate(
+2
View File
@@ -1497,6 +1497,8 @@ pub fn run() {
commands_v2::v2_set_audio_dac_passthrough,
commands_v2::v2_set_audio_pw_force_bitperfect,
commands_v2::v2_set_sync_audio_on_startup,
commands_v2::v2_get_quality_fallback_behavior,
commands_v2::v2_set_quality_fallback_behavior,
commands_v2::v2_set_audio_sample_rate,
commands_v2::v2_set_audio_backend_type,
commands_v2::v2_set_audio_alsa_plugin,