CRITICAL FIX: ReinitDevice now uses backend system
PROBLEMA ENCONTRADO: 1. Frontend guardaba backend_type correctamente ✅ 2. Player leía settings al inicio (backend_type = None) ✅ 3. Usuario cambiaba backend en UI → se guardaba en BD ✅ 4. Pero Player en memoria tenía settings VIEJOS ❌ 5. reinit_audio_device usaba legacy CPAL sin backend ❌ SÍNTOMAS: - "Backend system not configured, using legacy CPAL path" - "Device '...' not found, using default" - Audio salía por laptop speakers, no por DAC SOLUCIÓN IMPLEMENTADA: 1. init_device() ahora intenta backend system primero: - Lee thread_settings.backend_type - Si configurado, llama try_init_stream_with_backend() - Fallback a legacy CPAL si falla 2. reinit_audio_device() recarga settings desde BD: - Lee AudioSettings desde database - Actualiza Player.audio_settings en memoria - Luego llama reinit_device() - Garantiza que Player siempre tiene config fresca AHORA FUNCIONARÁ: - Cambiar backend → se guarda → se recarga → se usa - Cambiar device → se guarda → se recarga → se usa - PULSE_SINK se setea correctamente - Audio debe salir por Cambridge DAC TESTING REQUERIDO: Ir a Settings → Audio → Backend: PipeWire → Device: DacMagic Plus Reproducir música → debería salir por DAC
This commit is contained in:
1 parent
e1d56145d1
commit
e74c642831
2 files changed
+33
No files matched your search
@@ -536,8 +536,20 @@ pub fn get_audio_output_status(
|
||||
pub fn reinit_audio_device(
|
||||
device: Option<String>,
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
audio_settings_state: tauri::State<'_, crate::config::audio_settings::AudioSettingsState>,
|
||||
) -> Result<(), String> {
|
||||
log::info!("Command: reinit_audio_device {:?}", device);
|
||||
|
||||
// Reload settings from database to ensure Player has latest config (including backend_type)
|
||||
if let Ok(store) = audio_settings_state.store.lock() {
|
||||
if let Ok(fresh_settings) = store.get_settings() {
|
||||
if let Ok(mut player_settings) = state.player.audio_settings.lock() {
|
||||
*player_settings = fresh_settings;
|
||||
log::info!("Reloaded audio settings before reinit (backend_type: {:?})", player_settings.backend_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
state.player.reinit_device(device)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user