Implement smart toggles with automatic incompatibility handling
- Add DAC Passthrough auto-disable when ALSA Direct backend is selected - DAC Passthrough toggle becomes disabled (grayed out) with ALSA Direct - Add tooltip explaining why DAC Passthrough is disabled with ALSA Direct - Always reset Output Device to System Default when backend changes - Preserve existing auto-disable of Exclusive Mode with PipeWire/Auto This ensures incompatible feature combinations are handled automatically, respecting the user's last manual change while preventing invalid states.
This commit is contained in:
1 parent
4486d1dd80
commit
122eac7e15
1 file changed
+20
-5
@@ -258,6 +258,12 @@
|
|||||||
? 'Exclusive mode is only available with ALSA Direct backend. PipeWire is a multiplexed audio server and cannot provide true exclusive access.'
|
? 'Exclusive mode is only available with ALSA Direct backend. PipeWire is a multiplexed audio server and cannot provide true exclusive access.'
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
|
let dacPassthroughDisabled = $derived(selectedBackend === 'ALSA Direct');
|
||||||
|
let dacPassthroughTooltipOverride = $derived(
|
||||||
|
dacPassthroughDisabled
|
||||||
|
? 'DAC Passthrough uses pw-metadata to force PipeWire sample rates. It is not compatible with ALSA Direct backend. Use ALSA Direct for true bit-perfect playback without needing this setting.'
|
||||||
|
: null
|
||||||
|
);
|
||||||
let gaplessDisabled = $derived(dacPassthrough);
|
let gaplessDisabled = $derived(dacPassthrough);
|
||||||
let gaplessTooltipOverride = $derived(
|
let gaplessTooltipOverride = $derived(
|
||||||
gaplessDisabled
|
gaplessDisabled
|
||||||
@@ -876,6 +882,14 @@
|
|||||||
const backendType = backendName === 'Auto' ? null : backend?.backend_type ?? null;
|
const backendType = backendName === 'Auto' ? null : backend?.backend_type ?? null;
|
||||||
|
|
||||||
// Auto-disable incompatible features
|
// Auto-disable incompatible features
|
||||||
|
if (backendName === 'ALSA Direct') {
|
||||||
|
if (dacPassthrough) {
|
||||||
|
dacPassthrough = false;
|
||||||
|
await invoke('set_audio_dac_passthrough', { enabled: false });
|
||||||
|
console.log('[Audio] Disabled DAC Passthrough (incompatible with ALSA Direct)');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (backendName === 'PipeWire' || backendName === 'Auto') {
|
if (backendName === 'PipeWire' || backendName === 'Auto') {
|
||||||
if (exclusiveMode) {
|
if (exclusiveMode) {
|
||||||
exclusiveMode = false;
|
exclusiveMode = false;
|
||||||
@@ -892,11 +906,12 @@
|
|||||||
// Load devices for new backend
|
// Load devices for new backend
|
||||||
if (backendType) {
|
if (backendType) {
|
||||||
await loadBackendDevices(backendType);
|
await loadBackendDevices(backendType);
|
||||||
// Reset to default device when switching backends
|
|
||||||
outputDevice = 'System Default';
|
|
||||||
await invoke('set_audio_output_device', { device: null });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset to default device when switching backends (always)
|
||||||
|
outputDevice = 'System Default';
|
||||||
|
await invoke('set_audio_output_device', { device: null });
|
||||||
|
|
||||||
// Reinitialize audio
|
// Reinitialize audio
|
||||||
await invoke('reinit_audio_device', { device: null });
|
await invoke('reinit_audio_device', { device: null });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -1287,9 +1302,9 @@
|
|||||||
<div class="setting-row">
|
<div class="setting-row">
|
||||||
<div class="label-with-tooltip">
|
<div class="label-with-tooltip">
|
||||||
<span class="setting-label">{$t('settings.audio.dacPassthrough')}</span>
|
<span class="setting-label">{$t('settings.audio.dacPassthrough')}</span>
|
||||||
<Tooltip text={$t('settings.audio.dacPassthroughDesc')} />
|
<Tooltip text={dacPassthroughTooltipOverride ?? $t('settings.audio.dacPassthroughDesc')} />
|
||||||
</div>
|
</div>
|
||||||
<Toggle enabled={dacPassthrough} onchange={handleDacPassthroughChange} />
|
<Toggle enabled={dacPassthrough} onchange={handleDacPassthroughChange} disabled={dacPassthroughDisabled} />
|
||||||
</div>
|
</div>
|
||||||
<div class="setting-row last">
|
<div class="setting-row last">
|
||||||
<span class="setting-label">{$t('settings.audio.currentSampleRate')}</span>
|
<span class="setting-label">{$t('settings.audio.currentSampleRate')}</span>
|
||||||
|
|||||||
Reference in new issue
Block a user