refactor(ui): move gapless toggle from player bar to settings
Remove gapless button from NowPlayingBar and place it in SettingsView under Playback section. The toggle is now sensitive to blocking settings: auto-disables when ALSA Direct backend or streaming-only mode is activated. Gapless itself never blocks other settings. Added inline experimental label and descriptive tooltips with proper i18n for all 4 locales.
This commit is contained in:
1 parent
71bfb8dc17
commit
d2531ea700
7 files changed
+64
-84
No files matched your search
@@ -7,7 +7,6 @@
|
|||||||
SkipForward,
|
SkipForward,
|
||||||
Repeat,
|
Repeat,
|
||||||
Repeat1,
|
Repeat1,
|
||||||
Disc3,
|
|
||||||
Heart,
|
Heart,
|
||||||
Plus,
|
Plus,
|
||||||
Volume2,
|
Volume2,
|
||||||
@@ -73,8 +72,6 @@
|
|||||||
normalizationEnabled?: boolean;
|
normalizationEnabled?: boolean;
|
||||||
normalizationGain?: number | null;
|
normalizationGain?: number | null;
|
||||||
onToggleNormalization?: () => void;
|
onToggleNormalization?: () => void;
|
||||||
gaplessEnabled?: boolean;
|
|
||||||
onToggleGapless?: () => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let {
|
let {
|
||||||
@@ -120,8 +117,6 @@
|
|||||||
normalizationEnabled = false,
|
normalizationEnabled = false,
|
||||||
normalizationGain = null,
|
normalizationGain = null,
|
||||||
onToggleNormalization,
|
onToggleNormalization,
|
||||||
gaplessEnabled = false,
|
|
||||||
onToggleGapless
|
|
||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
|
|
||||||
let progressRef: HTMLDivElement;
|
let progressRef: HTMLDivElement;
|
||||||
@@ -279,15 +274,6 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
|
||||||
class="control-btn"
|
|
||||||
class:active={gaplessEnabled}
|
|
||||||
onclick={onToggleGapless}
|
|
||||||
title={gaplessEnabled ? $t('player.gaplessOn') : $t('player.gaplessOff')}
|
|
||||||
>
|
|
||||||
<Disc3 size={16} />
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button class="control-btn" onclick={onAddToPlaylist} title={$t('actions.addToPlaylist')}>
|
<button class="control-btn" onclick={onAddToPlaylist} title={$t('actions.addToPlaylist')}>
|
||||||
<Plus size={16} />
|
<Plus size={16} />
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -590,11 +590,15 @@
|
|||||||
? 'settings.audio.dacPassthroughDisabledDesc'
|
? 'settings.audio.dacPassthroughDisabledDesc'
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
let gaplessDisabled = $derived(dacPassthrough);
|
let gaplessDisabled = $derived(
|
||||||
let gaplessTooltipOverride = $derived(
|
selectedBackend === 'ALSA Direct' || streamingOnly
|
||||||
gaplessDisabled
|
);
|
||||||
? 'Gapless playback is disabled when DAC Passthrough is enabled. Bit-perfect audio requires recreating streams for each sample rate change.'
|
let gaplessDisabledReasonKey = $derived(
|
||||||
: null
|
selectedBackend === 'ALSA Direct'
|
||||||
|
? 'settings.playback.gaplessDisabledAlsa'
|
||||||
|
: streamingOnly
|
||||||
|
? 'settings.playback.gaplessDisabledStreaming'
|
||||||
|
: null
|
||||||
);
|
);
|
||||||
|
|
||||||
// Playback settings
|
// Playback settings
|
||||||
@@ -1523,18 +1527,7 @@
|
|||||||
streamBufferSeconds = settings.stream_buffer_seconds ?? 3;
|
streamBufferSeconds = settings.stream_buffer_seconds ?? 3;
|
||||||
streamingOnly = settings.streaming_only ?? false;
|
streamingOnly = settings.streaming_only ?? false;
|
||||||
limitQualityToDevice = settings.limit_quality_to_device ?? true;
|
limitQualityToDevice = settings.limit_quality_to_device ?? true;
|
||||||
|
gaplessPlayback = settings.gapless_enabled ?? true;
|
||||||
// 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) {
|
} catch (err) {
|
||||||
console.error('Failed to load audio settings:', err);
|
console.error('Failed to load audio settings:', err);
|
||||||
}
|
}
|
||||||
@@ -1588,13 +1581,6 @@
|
|||||||
async function handleDacPassthroughChange(enabled: boolean) {
|
async function handleDacPassthroughChange(enabled: boolean) {
|
||||||
dacPassthrough = enabled;
|
dacPassthrough = enabled;
|
||||||
|
|
||||||
// Auto-disable incompatible playback settings
|
|
||||||
if (enabled) {
|
|
||||||
gaplessPlayback = false;
|
|
||||||
crossfade = 0;
|
|
||||||
console.log('[Audio] DAC passthrough enabled: disabled gapless playback and crossfade');
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await invoke('set_audio_dac_passthrough', { enabled });
|
await invoke('set_audio_dac_passthrough', { enabled });
|
||||||
|
|
||||||
@@ -1633,6 +1619,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gapless not compatible with ALSA Direct
|
||||||
|
if (backendName === 'ALSA Direct') {
|
||||||
|
if (gaplessPlayback) {
|
||||||
|
gaplessPlayback = false;
|
||||||
|
await invoke('set_audio_gapless_enabled', { enabled: false });
|
||||||
|
console.log('[Audio] Disabled gapless playback (not compatible with ALSA Direct)');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Save backend preference
|
// Save backend preference
|
||||||
await invoke('set_audio_backend_type', { backendType });
|
await invoke('set_audio_backend_type', { backendType });
|
||||||
@@ -1714,6 +1709,14 @@
|
|||||||
|
|
||||||
async function handleStreamingOnlyChange(enabled: boolean) {
|
async function handleStreamingOnlyChange(enabled: boolean) {
|
||||||
streamingOnly = enabled;
|
streamingOnly = enabled;
|
||||||
|
|
||||||
|
// Gapless not compatible with streaming-only
|
||||||
|
if (enabled && gaplessPlayback) {
|
||||||
|
gaplessPlayback = false;
|
||||||
|
await invoke('set_audio_gapless_enabled', { enabled: false });
|
||||||
|
console.log('[Audio] Disabled gapless playback (not compatible with streaming-only)');
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await invoke('set_audio_streaming_only', { enabled });
|
await invoke('set_audio_streaming_only', { enabled });
|
||||||
console.log('[Audio] Streaming-only mode changed:', enabled);
|
console.log('[Audio] Streaming-only mode changed:', enabled);
|
||||||
@@ -1759,20 +1762,11 @@
|
|||||||
|
|
||||||
async function handleGaplessPlaybackChange(enabled: boolean) {
|
async function handleGaplessPlaybackChange(enabled: boolean) {
|
||||||
gaplessPlayback = enabled;
|
gaplessPlayback = enabled;
|
||||||
|
try {
|
||||||
// Auto-disable DAC passthrough if incompatible
|
await invoke('set_audio_gapless_enabled', { enabled });
|
||||||
if (enabled && dacPassthrough) {
|
console.log('[Audio] Gapless playback changed:', enabled);
|
||||||
dacPassthrough = false;
|
} catch (err) {
|
||||||
console.log('[Audio] Gapless playback enabled: disabled DAC passthrough');
|
console.error('[Audio] Failed to change gapless playback:', err);
|
||||||
try {
|
|
||||||
await invoke('set_audio_dac_passthrough', { enabled: false });
|
|
||||||
|
|
||||||
// Reinitialize audio with currently selected device
|
|
||||||
const deviceName = getCurrentDeviceSinkName();
|
|
||||||
await reinitAndResume(deviceName);
|
|
||||||
} catch (err) {
|
|
||||||
console.error('[Audio] Failed to disable DAC passthrough:', err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2419,17 +2413,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<Toggle enabled={showContextIcon} onchange={handleShowContextIconChange} />
|
<Toggle enabled={showContextIcon} onchange={handleShowContextIconChange} />
|
||||||
</div>
|
</div>
|
||||||
<!-- Gapless, Crossfade, Normalize Volume hidden until properly implemented (see issue #29) -->
|
<div class="setting-row">
|
||||||
<!-- <div class="setting-row">
|
|
||||||
<div class="setting-info">
|
<div class="setting-info">
|
||||||
<span class="setting-label">{$t('settings.playback.gapless')}</span>
|
<span class="setting-label">{$t('settings.playback.gapless')} <span class="experimental-inline">{$t('settings.playback.experimental')}</span></span>
|
||||||
{#if gaplessTooltipOverride}
|
<span class="setting-desc">{gaplessDisabledReasonKey ? $t(gaplessDisabledReasonKey) : $t('settings.playback.gaplessDesc')}</span>
|
||||||
<span class="setting-desc">{gaplessTooltipOverride}</span>
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
<Toggle enabled={gaplessPlayback} onchange={handleGaplessPlaybackChange} disabled={gaplessDisabled} />
|
<Toggle enabled={gaplessPlayback} onchange={handleGaplessPlaybackChange} disabled={gaplessDisabled} />
|
||||||
</div>
|
</div>
|
||||||
<div class="setting-row">
|
<!-- Crossfade, Normalize Volume hidden until properly implemented (see issue #29) -->
|
||||||
|
<!-- <div class="setting-row">
|
||||||
<span class="setting-label">{$t('settings.playback.crossfade')}</span>
|
<span class="setting-label">{$t('settings.playback.crossfade')}</span>
|
||||||
<div class="slider-container">
|
<div class="slider-container">
|
||||||
<VolumeSlider value={crossfade} onchange={handleCrossfadeChange} max={12} showValue />
|
<VolumeSlider value={crossfade} onchange={handleCrossfadeChange} max={12} showValue />
|
||||||
@@ -3613,6 +3605,15 @@ flatpak override --user --filesystem=/home/USUARIO/Música com.blitzfc.qbz</pre>
|
|||||||
border: 1px solid rgba(239, 68, 68, 0.3);
|
border: 1px solid rgba(239, 68, 68, 0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.experimental-inline {
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.3px;
|
||||||
|
color: var(--text-muted);
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
.setup-guide-btn {
|
.setup-guide-btn {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
padding: 6px 12px;
|
padding: 6px 12px;
|
||||||
|
|||||||
@@ -369,8 +369,6 @@
|
|||||||
"repeatAll": "Alles wiederholen",
|
"repeatAll": "Alles wiederholen",
|
||||||
"repeatOne": "Einen wiederholen",
|
"repeatOne": "Einen wiederholen",
|
||||||
"repeatOff": "Wiederholung aus",
|
"repeatOff": "Wiederholung aus",
|
||||||
"gaplessOn": "Lückenlos: Ein",
|
|
||||||
"gaplessOff": "Lückenlos: Aus",
|
|
||||||
"previous": "Vorherige",
|
"previous": "Vorherige",
|
||||||
"next": "Nächste",
|
"next": "Nächste",
|
||||||
"play": "Abspielen",
|
"play": "Abspielen",
|
||||||
@@ -543,6 +541,10 @@
|
|||||||
"playback": {
|
"playback": {
|
||||||
"title": "Wiedergabe",
|
"title": "Wiedergabe",
|
||||||
"gapless": "Lückenlose Wiedergabe",
|
"gapless": "Lückenlose Wiedergabe",
|
||||||
|
"gaplessDesc": "Nahtlose Übergänge zwischen gecachten Titeln mit gleichem Format",
|
||||||
|
"gaplessDisabledAlsa": "Nicht verfügbar mit ALSA Direct-Backend",
|
||||||
|
"gaplessDisabledStreaming": "Nicht verfügbar im Nur-Streaming-Modus",
|
||||||
|
"experimental": "experimentell",
|
||||||
"crossfade": "Überblenden",
|
"crossfade": "Überblenden",
|
||||||
"crossfadeSeconds": "{seconds}s",
|
"crossfadeSeconds": "{seconds}s",
|
||||||
"normalizeVolume": "Lautstärke normalisieren",
|
"normalizeVolume": "Lautstärke normalisieren",
|
||||||
|
|||||||
@@ -383,8 +383,6 @@
|
|||||||
"repeatAll": "Repeat All",
|
"repeatAll": "Repeat All",
|
||||||
"repeatOne": "Repeat One",
|
"repeatOne": "Repeat One",
|
||||||
"repeatOff": "Repeat Off",
|
"repeatOff": "Repeat Off",
|
||||||
"gaplessOn": "Gapless: On",
|
|
||||||
"gaplessOff": "Gapless: Off",
|
|
||||||
"previous": "Previous",
|
"previous": "Previous",
|
||||||
"next": "Next",
|
"next": "Next",
|
||||||
"play": "Play",
|
"play": "Play",
|
||||||
@@ -561,6 +559,10 @@
|
|||||||
"playback": {
|
"playback": {
|
||||||
"title": "Playback",
|
"title": "Playback",
|
||||||
"gapless": "Gapless Playback",
|
"gapless": "Gapless Playback",
|
||||||
|
"gaplessDesc": "Seamless transitions between cached tracks with matching format",
|
||||||
|
"gaplessDisabledAlsa": "Not available with ALSA Direct backend",
|
||||||
|
"gaplessDisabledStreaming": "Not available in streaming-only mode",
|
||||||
|
"experimental": "experimental",
|
||||||
"crossfade": "Crossfade",
|
"crossfade": "Crossfade",
|
||||||
"crossfadeSeconds": "{seconds}s",
|
"crossfadeSeconds": "{seconds}s",
|
||||||
"normalizeVolume": "Normalize Volume",
|
"normalizeVolume": "Normalize Volume",
|
||||||
|
|||||||
@@ -383,8 +383,6 @@
|
|||||||
"repeatAll": "Repetir Todo",
|
"repeatAll": "Repetir Todo",
|
||||||
"repeatOne": "Repetir Una",
|
"repeatOne": "Repetir Una",
|
||||||
"repeatOff": "No Repetir",
|
"repeatOff": "No Repetir",
|
||||||
"gaplessOn": "Sin pausas: Activado",
|
|
||||||
"gaplessOff": "Sin pausas: Desactivado",
|
|
||||||
"previous": "Anterior",
|
"previous": "Anterior",
|
||||||
"next": "Siguiente",
|
"next": "Siguiente",
|
||||||
"play": "Reproducir",
|
"play": "Reproducir",
|
||||||
@@ -561,6 +559,10 @@
|
|||||||
"playback": {
|
"playback": {
|
||||||
"title": "Reproducción",
|
"title": "Reproducción",
|
||||||
"gapless": "Reproducción Sin Pausas",
|
"gapless": "Reproducción Sin Pausas",
|
||||||
|
"gaplessDesc": "Transiciones sin cortes entre pistas en caché con formato compatible",
|
||||||
|
"gaplessDisabledAlsa": "No disponible con el backend ALSA Direct",
|
||||||
|
"gaplessDisabledStreaming": "No disponible en modo solo streaming",
|
||||||
|
"experimental": "experimental",
|
||||||
"crossfade": "Crossfade",
|
"crossfade": "Crossfade",
|
||||||
"crossfadeSeconds": "{seconds}s",
|
"crossfadeSeconds": "{seconds}s",
|
||||||
"normalizeVolume": "Normalizar Volumen",
|
"normalizeVolume": "Normalizar Volumen",
|
||||||
|
|||||||
@@ -369,8 +369,6 @@
|
|||||||
"repeatAll": "Répéter tout",
|
"repeatAll": "Répéter tout",
|
||||||
"repeatOne": "Répéter un",
|
"repeatOne": "Répéter un",
|
||||||
"repeatOff": "Répéter désactivé",
|
"repeatOff": "Répéter désactivé",
|
||||||
"gaplessOn": "Sans coupure : Activé",
|
|
||||||
"gaplessOff": "Sans coupure : Désactivé",
|
|
||||||
"previous": "Précédent",
|
"previous": "Précédent",
|
||||||
"next": "Suivant",
|
"next": "Suivant",
|
||||||
"play": "Lecture",
|
"play": "Lecture",
|
||||||
@@ -543,6 +541,10 @@
|
|||||||
"playback": {
|
"playback": {
|
||||||
"title": "Lecture",
|
"title": "Lecture",
|
||||||
"gapless": "Lecture sans interruption",
|
"gapless": "Lecture sans interruption",
|
||||||
|
"gaplessDesc": "Transitions fluides entre les pistes en cache avec un format compatible",
|
||||||
|
"gaplessDisabledAlsa": "Non disponible avec le backend ALSA Direct",
|
||||||
|
"gaplessDisabledStreaming": "Non disponible en mode streaming uniquement",
|
||||||
|
"experimental": "expérimental",
|
||||||
"crossfade": "Fondu enchaîné",
|
"crossfade": "Fondu enchaîné",
|
||||||
"crossfadeSeconds": "{seconds}s",
|
"crossfadeSeconds": "{seconds}s",
|
||||||
"normalizeVolume": "Normaliser le volume",
|
"normalizeVolume": "Normaliser le volume",
|
||||||
|
|||||||
+2
-17
@@ -535,8 +535,6 @@
|
|||||||
let isFavorite = $state(false);
|
let isFavorite = $state(false);
|
||||||
let normalizationEnabled = $state(false);
|
let normalizationEnabled = $state(false);
|
||||||
let normalizationGain = $state<number | null>(null);
|
let normalizationGain = $state<number | null>(null);
|
||||||
let gaplessEnabled = $state(true);
|
|
||||||
|
|
||||||
// Queue/Shuffle State (from queueStore subscription)
|
// Queue/Shuffle State (from queueStore subscription)
|
||||||
let isShuffle = $state(false);
|
let isShuffle = $state(false);
|
||||||
let repeatMode = $state<RepeatMode>('off');
|
let repeatMode = $state<RepeatMode>('off');
|
||||||
@@ -1397,16 +1395,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toggleGapless() {
|
|
||||||
const newState = !gaplessEnabled;
|
|
||||||
try {
|
|
||||||
await invoke('set_audio_gapless_enabled', { enabled: newState });
|
|
||||||
gaplessEnabled = newState;
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Failed to toggle gapless:', err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add to Playlist handler for Now Playing track
|
// Add to Playlist handler for Now Playing track
|
||||||
function openAddToPlaylistModal() {
|
function openAddToPlaylistModal() {
|
||||||
if (!currentTrack) return;
|
if (!currentTrack) return;
|
||||||
@@ -2555,10 +2543,9 @@
|
|||||||
// Ignore storage errors
|
// Ignore storage errors
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load normalization + gapless enabled state from audio settings
|
// Load normalization enabled state from audio settings
|
||||||
invoke<{ normalization_enabled: boolean; gapless_enabled: boolean }>('get_audio_settings').then((settings) => {
|
invoke<{ normalization_enabled: boolean }>('get_audio_settings').then((settings) => {
|
||||||
normalizationEnabled = settings.normalization_enabled;
|
normalizationEnabled = settings.normalization_enabled;
|
||||||
gaplessEnabled = settings.gapless_enabled;
|
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error('Failed to load audio settings:', err);
|
console.error('Failed to load audio settings:', err);
|
||||||
});
|
});
|
||||||
@@ -3418,8 +3405,6 @@
|
|||||||
{normalizationEnabled}
|
{normalizationEnabled}
|
||||||
{normalizationGain}
|
{normalizationGain}
|
||||||
onToggleNormalization={toggleNormalization}
|
onToggleNormalization={toggleNormalization}
|
||||||
{gaplessEnabled}
|
|
||||||
onToggleGapless={toggleGapless}
|
|
||||||
onTrackClick={() => {
|
onTrackClick={() => {
|
||||||
if (currentTrack && !currentTrack.isLocal) {
|
if (currentTrack && !currentTrack.isLocal) {
|
||||||
trackInfoTrackId = currentTrack.id;
|
trackInfoTrackId = currentTrack.id;
|
||||||
|
|||||||
Reference in new issue
Block a user