diff --git a/src/lib/components/AudioOutputBadges.svelte b/src/lib/components/AudioOutputBadges.svelte index 7b52b87a0..5d9d82efb 100644 --- a/src/lib/components/AudioOutputBadges.svelte +++ b/src/lib/components/AudioOutputBadges.svelte @@ -44,7 +44,6 @@ let pipewireSinks = $state([]); let hardwareStatus = $state(null); let isHovering = $state(false); - let previousSamplingRate = $state(undefined); // Derived state const currentDevice = $derived(outputStatus?.device_name ?? null); @@ -148,23 +147,24 @@ } } - // Update hardware status when sampling rate changes (new song with different rate) - $effect(() => { - if (samplingRate !== undefined && samplingRate !== previousSamplingRate) { - // Sampling rate changed - new song or format change - previousSamplingRate = samplingRate; - - // Update hardware status to verify bit-perfect playback - if (settings?.dac_passthrough || settings?.backend_type === 'Alsa') { - invoke('get_hardware_audio_status') - .then(status => hardwareStatus = status) - .catch(() => hardwareStatus = null); - } - } - }); - onMount(() => { loadStatus(); + + // Lightweight polling: ONLY update hardware status (no device enumeration) + // This reads /proc/asound which is very cheap, no CPAL/ALSA enumeration + const pollInterval = setInterval(async () => { + // Only poll if using bit-perfect modes + if (settings?.dac_passthrough || settings?.backend_type === 'Alsa') { + try { + hardwareStatus = await invoke('get_hardware_audio_status').catch(() => null); + } catch (err) { + // Silently fail - don't spam console + } + } + }, 1000); + + // Cleanup on unmount + return () => clearInterval(pollInterval); });