Revert to CPAL enumeration + aplay -L for descriptions only

Critical Fix - Use CPAL Device Names:
- CPAL enumerates devices → these IDs actually work for playback
- aplay -L provides friendly descriptions → update CPAL device descriptions
- Stop creating hw:X,Y devices that CPAL doesn't recognize
- Fixes: "Device not found → fallback to default → audio from laptop"

Flow:
1. enumerate_via_cpal() returns devices CPAL can actually use
2. enumerate_via_aplay() calls #1, then parses aplay -L for descriptions
3. Updates device.description with friendly names from aplay -L
4. Frontend shows: "Cambridge Audio USB Audio 2.0" not "front:CARD=C20,DEV=0"

Loading Overlay:
- Full-screen semi-transparent overlay during device enumeration
- Animated spinner (Loader2 icon)
- "Loading audio devices... / Parsing hardware information"
- Prevents user thinking app is frozen during 4-5 second aplay parse

For Bit-Perfect Playback:
- User should select devices like front:CARD=C20,DEV=0 (CPAL knows these)
- These are more direct than sysdefault:CARD= (which has dmix/plugins)
- Not as direct as hw:4,0 but CPAL can actually find them

PipeWire and PulseAudio backends unchanged - still working as before.
This commit is contained in:
vicrodh committed 2026-01-17 21:12:18 -06:00
1 parent 63b6809259
commit 845d53c672
2 files changed
+78 -142

No files matched your search

+58 -1
View File
@@ -2,7 +2,7 @@
import { onMount } from 'svelte';
import { invoke } from '@tauri-apps/api/core';
import { getCurrentWebview } from '@tauri-apps/api/webview';
import { ArrowLeft, FolderOpen, ChevronDown, ChevronRight } from 'lucide-svelte';
import { ArrowLeft, FolderOpen, ChevronDown, ChevronRight, Loader2 } from 'lucide-svelte';
import Toggle from '../Toggle.svelte';
import Dropdown from '../Dropdown.svelte';
import VolumeSlider from '../VolumeSlider.svelte';
@@ -1234,6 +1234,17 @@
</script>
<div class="settings-view" bind:this={settingsViewEl}>
<!-- Loading Overlay for Device Enumeration -->
{#if isLoadingDevices}
<div class="loading-overlay">
<div class="loading-content">
<Loader2 size={48} class="spinner" />
<p>Loading audio devices...</p>
<p class="loading-subtitle">Parsing hardware information</p>
</div>
</div>
{/if}
<!-- Header -->
<div class="header">
{#if onBack}
@@ -1757,6 +1768,52 @@
font-style: italic;
}
.loading-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.7);
backdrop-filter: blur(4px);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
}
.loading-content {
text-align: center;
color: white;
}
.loading-content :global(.spinner) {
animation: spin 1s linear infinite;
margin: 0 auto 16px auto;
}
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.loading-content p {
margin: 0;
font-size: 18px;
font-weight: 500;
}
.loading-subtitle {
margin-top: 8px !important;
font-size: 14px !important;
opacity: 0.7;
font-weight: 400 !important;
}
.header {
padding-top: 24px;
margin-bottom: 32px;