Fix DAC badge showing 'Default' instead of actual device
The badge was always showing 'Default' regardless of the selected device because thread_state.set_current_device() was only being called in the legacy CPAL path, not in the backend system path (PipeWire DAC, ALSA Direct). Root cause: - Lines 801-805: Backend system creates stream but never sets current_device - Lines 847, 883: Only legacy CPAL path was setting device name from CPAL device.name() - UI badge calls get_audio_output_status() which returns player.state.current_device() - current_device was None/outdated when using backend system Fix: - After successful stream creation (line 897), read output_device from settings - Set thread_state.current_device with the device name from settings - Fallback to 'Default' string if output_device is None - Now badge shows: 'hw:4,0', 'DacMagic Plus Analog Stereo', etc. Testing: - ALSA Direct: Should show 'hw:4,0' or configured device - PipeWire DAC: Should show 'DacMagic Plus Analog Stereo' or selected sink - System Default: Should show 'Default'
This commit is contained in:
1 parent
f88cee7674
commit
97c9473790
1 file changed
+13
-1
@@ -899,7 +899,19 @@ impl Player {
|
||||
*current_sample_rate = Some(sample_rate);
|
||||
*current_channels = Some(channels);
|
||||
thread_state.set_stream_error(false);
|
||||
log::info!("✅ Audio stream ready at {}Hz", sample_rate);
|
||||
|
||||
// Set current device name from settings (for backend system)
|
||||
if let Some(settings) = thread_settings.lock().ok() {
|
||||
if let Some(ref device_name) = settings.output_device {
|
||||
thread_state.set_current_device(Some(device_name.clone()));
|
||||
log::info!("✅ Audio stream ready at {}Hz on device: {}", sample_rate, device_name);
|
||||
} else {
|
||||
thread_state.set_current_device(Some("Default".to_string()));
|
||||
log::info!("✅ Audio stream ready at {}Hz on default device", sample_rate);
|
||||
}
|
||||
} else {
|
||||
log::info!("✅ Audio stream ready at {}Hz", sample_rate);
|
||||
}
|
||||
|
||||
// Small delay to ensure stream is fully initialized before decoder starts
|
||||
// This prevents sync gaps when changing sample rates
|
||||
|
||||
Reference in new issue
Block a user