Fix ALSA device enumeration and Auto backend translation

Problem 1: ALSA Direct showed NO devices because aplay -L output doesn't
match CPAL device names, causing create_output_stream to fail.

Solution: Revert to CPAL enumeration but with blacklist filtering to skip
non-playback devices (null, lavrate, samplerate, speexrate, jack, oss,
speex, upmix, vdownmix).

Problem 2: Auto backend didn't apply fancy names because needsTranslation()
was too restrictive and didn't cover all ALSA device name patterns.

Solution: Simplify to: if device name starts with 'alsa_output.' it's from
PipeWire (already has friendly name), otherwise it's ALSA (needs translation).
This covers ALL ALSA naming patterns including front:CARD=, sysdefault:CARD=,
hw:, hdmi:, iec958:, etc.

Changes:
- alsa_backend.rs: Back to CPAL with blacklist filter
- SettingsView.svelte: Simplified needsTranslation() logic
This commit is contained in:
vicrodh committed 2026-01-17 18:24:18 -06:00
1 parent fd09f5078a
commit 4486d1dd80
2 files changed
+54 -74

No files matched your search

+7 -9
View File
@@ -217,15 +217,13 @@
// Helper to check if a device name looks like raw ALSA (needs translation)
function needsTranslation(name: string): boolean {
return name.startsWith('hw:')
|| name.startsWith('plughw:')
|| name.startsWith('sysdefault:CARD=')
|| name.startsWith('default:CARD=')
|| name.startsWith('front:CARD=')
|| name.startsWith('surround')
|| name.startsWith('hdmi:')
|| name.startsWith('iec958:')
|| name === 'default';
// PipeWire device names start with "alsa_output." - those already have friendly names
if (name.startsWith('alsa_output.')) {
return false;
}
// Everything else from ALSA needs translation
return true;
}
// Device options based on selected backend (derived)