fix: improve tooltip UX and enforce mutual exclusion on load
Tooltip improvements: - Consolidate duplicate tooltips into single unified tooltip - Show device info + DAC status + sample rate in one place - Remove native 'title' attributes that were causing conflicts - Add visual indicators (colored dots) for setting states - Display resampling warning with actual rates when detected - Better structured tooltip with sections Mutual exclusion enforcement: - Validate settings on load in loadAudioSettings() - Auto-disable Gapless and Crossfade if DAC Passthrough is enabled - Prevents invalid state from persisted settings This fixes the issue where users could have incompatible settings active simultaneously after app restart.
This commit is contained in:
1 parent
a95575b7df
commit
40cd6d7303
2 files changed
+103
-12
No files matched your search
@@ -157,7 +157,6 @@
|
||||
class:active={dacBadgeState === 'active'}
|
||||
class:warning={dacBadgeState === 'warning'}
|
||||
class:off={dacBadgeState === 'off'}
|
||||
title={showTooltips ? dacTooltip : undefined}
|
||||
>
|
||||
<span class="badge-label">DAC</span>
|
||||
</div>
|
||||
@@ -166,23 +165,58 @@
|
||||
<div
|
||||
class="badge"
|
||||
class:active={exclusiveModeActive}
|
||||
title={showTooltips ? (exclusiveModeActive ? 'Exclusive Mode active' : 'Exclusive Mode inactive') : undefined}
|
||||
>
|
||||
<span class="badge-label">EXC</span>
|
||||
</div>
|
||||
|
||||
<!-- Device Tooltip on hover -->
|
||||
<!-- Unified Tooltip on hover -->
|
||||
{#if isHovering && showTooltips}
|
||||
<div class="device-tooltip">
|
||||
<div class="tooltip-label">Output Device</div>
|
||||
<div class="tooltip-device">{prettyDeviceName}</div>
|
||||
{#if currentDevice && currentDevice !== prettyDeviceName}
|
||||
<div class="tooltip-raw">{currentDevice}</div>
|
||||
{/if}
|
||||
{#if currentVolume !== null}
|
||||
<div class="tooltip-volume">
|
||||
<span class="volume-label">Volume:</span>
|
||||
<span class="volume-value">{currentVolume}%</span>
|
||||
<!-- Output Device -->
|
||||
<div class="tooltip-section">
|
||||
<div class="tooltip-label">Output Device</div>
|
||||
<div class="tooltip-device">{prettyDeviceName}</div>
|
||||
{#if currentDevice && currentDevice !== prettyDeviceName}
|
||||
<div class="tooltip-raw">{currentDevice}</div>
|
||||
{/if}
|
||||
{#if currentVolume !== null}
|
||||
<div class="tooltip-volume">
|
||||
<span class="volume-label">Volume:</span>
|
||||
<span class="volume-value">{currentVolume}%</span>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- DAC Status -->
|
||||
{#if settings?.dac_passthrough || settings?.exclusive_mode}
|
||||
<div class="tooltip-section">
|
||||
<div class="tooltip-label">Audio Settings</div>
|
||||
{#if settings.dac_passthrough}
|
||||
<div class="tooltip-setting" class:warning={dacBadgeState === 'warning'}>
|
||||
<span class="setting-icon" class:active={dacBadgeState === 'active'} class:warning={dacBadgeState === 'warning'}>●</span>
|
||||
<span class="setting-text">
|
||||
{#if dacBadgeState === 'warning'}
|
||||
⚠ DAC Passthrough: Resampling detected
|
||||
{#if hardwareStatus?.hardware_sample_rate && samplingRate}
|
||||
<br><span class="setting-detail">{samplingRate} kHz → {(hardwareStatus.hardware_sample_rate / 1000).toFixed(1)} kHz</span>
|
||||
{/if}
|
||||
{:else if dacBadgeState === 'active'}
|
||||
DAC Passthrough: Bit-perfect
|
||||
{#if hardwareStatus?.hardware_sample_rate}
|
||||
<br><span class="setting-detail">{(hardwareStatus.hardware_sample_rate / 1000).toFixed(1)} kHz</span>
|
||||
{/if}
|
||||
{:else}
|
||||
DAC Passthrough: Off
|
||||
{/if}
|
||||
</span>
|
||||
</div>
|
||||
{/if}
|
||||
{#if settings.exclusive_mode}
|
||||
<div class="tooltip-setting">
|
||||
<span class="setting-icon" class:active={exclusiveModeActive}>●</span>
|
||||
<span class="setting-text">Exclusive Mode</span>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -312,4 +346,49 @@
|
||||
font-weight: 500;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
|
||||
.tooltip-section {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.tooltip-section:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.tooltip-setting {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 6px;
|
||||
margin-top: 6px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.setting-icon {
|
||||
font-size: 8px;
|
||||
color: rgba(255, 255, 255, 0.3);
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.setting-icon.active {
|
||||
color: #22c55e;
|
||||
}
|
||||
|
||||
.setting-icon.warning {
|
||||
color: #eab308;
|
||||
}
|
||||
|
||||
.setting-text {
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.tooltip-setting.warning .setting-text {
|
||||
color: #eab308;
|
||||
}
|
||||
|
||||
.setting-detail {
|
||||
font-size: 10px;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
font-family: var(--font-mono, monospace);
|
||||
}
|
||||
</style>
|
||||
@@ -795,6 +795,18 @@
|
||||
}
|
||||
exclusiveMode = settings.exclusive_mode;
|
||||
dacPassthrough = settings.dac_passthrough;
|
||||
|
||||
// Validate mutual exclusion: DAC Passthrough disables Gapless + Crossfade
|
||||
if (dacPassthrough) {
|
||||
if (gaplessPlayback) {
|
||||
console.warn('DAC Passthrough and Gapless both enabled - disabling Gapless');
|
||||
gaplessPlayback = false;
|
||||
}
|
||||
if (crossfade > 0) {
|
||||
console.warn('DAC Passthrough and Crossfade both enabled - disabling Crossfade');
|
||||
crossfade = 0;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Failed to load audio settings:', err);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user