ALSA Direct Backend Implementation: - Fully functional ALSA backend using CPAL's ALSA host - Enumerates ALSA devices with hardware names - Supports custom sample rates for bit-perfect playback - Supports exclusive mode (device blocking) - Smaller buffer size (512 samples) for lower latency in exclusive mode - Clear error messages when device is in use Smart Toggles in UI: - Exclusive Mode auto-disabled with PipeWire/Auto backends (PipeWire is multiplexed and cannot provide true exclusive access) - Gapless Playback auto-disabled with DAC Passthrough (bit-perfect requires recreating streams for sample rate changes) - Toggle component now supports 'disabled' prop with visual feedback - Tooltips updated to explain why features are disabled - Auto-disable exclusive mode when switching to PipeWire backend User Benefits: - ALSA Direct now appears in backend dropdown - True exclusive mode available with ALSA Direct - Prevents confusing feature combinations - Clear explanations via tooltips - No more wondering why exclusive mode doesn't work with PipeWire Technical Notes: - ALSA backend uses CPAL host selection (not alsa-rs directly) - Disabled toggles shown as grayed out with cursor: not-allowed - Backend switching auto-adjusts incompatible settings
72 lines
1.2 KiB
Svelte
72 lines
1.2 KiB
Svelte
<script lang="ts">
|
|
interface Props {
|
|
enabled: boolean;
|
|
onchange: (enabled: boolean) => void;
|
|
disabled?: boolean;
|
|
}
|
|
|
|
let { enabled, onchange, disabled = false }: Props = $props();
|
|
|
|
function handleClick() {
|
|
if (!disabled) {
|
|
onchange(!enabled);
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<button
|
|
class="toggle"
|
|
class:enabled
|
|
class:disabled
|
|
onclick={handleClick}
|
|
role="switch"
|
|
aria-checked={enabled}
|
|
aria-disabled={disabled}
|
|
{disabled}
|
|
>
|
|
<div class="thumb"></div>
|
|
</button>
|
|
|
|
<style>
|
|
.toggle {
|
|
position: relative;
|
|
width: 44px;
|
|
min-width: 44px;
|
|
height: 24px;
|
|
border-radius: 9999px;
|
|
border: none;
|
|
background-color: #333333;
|
|
cursor: pointer;
|
|
transition: background-color 150ms ease;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.toggle.enabled {
|
|
background-color: var(--accent-primary);
|
|
}
|
|
|
|
.toggle.disabled {
|
|
opacity: 0.4;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.toggle.disabled.enabled {
|
|
background-color: #555555;
|
|
}
|
|
|
|
.thumb {
|
|
position: absolute;
|
|
top: 2px;
|
|
left: 2px;
|
|
width: 20px;
|
|
height: 20px;
|
|
border-radius: 50%;
|
|
background-color: white;
|
|
transition: transform 150ms ease;
|
|
}
|
|
|
|
.toggle.enabled .thumb {
|
|
transform: translateX(20px);
|
|
}
|
|
</style>
|