fix: poll output device name so it updates during playback
The device name was only read on mount and on hover, so it stayed as "No device" until the user hovered the badges area. Now the 1-second poll also reads get_audio_output_status (cheap in-memory read) alongside hardware status, keeping the device name current.
This commit is contained in:
1 file changed
+9
-5
@@ -182,15 +182,19 @@
|
|||||||
castProtocol = getConnectedProtocol();
|
castProtocol = getConnectedProtocol();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Lightweight polling: ONLY update hardware status (no device enumeration)
|
// Lightweight polling: update hardware status + output device name
|
||||||
// This reads /proc/asound which is very cheap, no CPAL/ALSA enumeration
|
|
||||||
const pollInterval = setInterval(async () => {
|
const pollInterval = setInterval(async () => {
|
||||||
// Only poll if using bit-perfect modes AND not casting
|
// Only poll if using bit-perfect modes AND not casting
|
||||||
if (!castConnected && (settings?.dac_passthrough || settings?.backend_type === 'Alsa')) {
|
if (!castConnected && (settings?.dac_passthrough || settings?.backend_type === 'Alsa')) {
|
||||||
try {
|
try {
|
||||||
hardwareStatus = await invoke<HardwareAudioStatus>('v2_get_hardware_audio_status').catch(() => null);
|
const [hwStatus, status] = await Promise.all([
|
||||||
} catch (err) {
|
invoke<HardwareAudioStatus>('v2_get_hardware_audio_status').catch(() => null),
|
||||||
// Silently fail - don't spam console
|
invoke<AudioOutputStatus>('get_audio_output_status').catch(() => null),
|
||||||
|
]);
|
||||||
|
hardwareStatus = hwStatus;
|
||||||
|
if (status) outputStatus = status;
|
||||||
|
} catch {
|
||||||
|
// Silently fail
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|||||||
Reference in new issue
Block a user