fix: enforce streaming quality setting by clearing cache on change
Issue #34 - Max quality setting not respected Changes: - Remove 'Prefer Highest Available' toggle (was dead code, conflicted with quality dropdown) - Clear playback cache (L1+L2) when streaming quality changes - Show toast notification when cache is cleared - Add description to streaming quality setting - Update i18n for new messages (en/es) This ensures the quality setting takes effect immediately, important for: - Users with metered internet connections - Users with hardware sample rate limitations (e.g., DACs limited to 96kHz) The Qobuz API respects format_id and downsamples server-side, so this change guarantees the correct quality is fetched for new streams.
This commit is contained in:
1 parent
f83eed1076
commit
38b7ea7aef
3 files changed
+23
-22
No files matched your search
@@ -379,8 +379,7 @@
|
||||
const availableLanguages = ['Auto', 'English', 'Español'];
|
||||
|
||||
// Audio settings
|
||||
let streamingQuality = $state('Hi-Res');
|
||||
let preferHighest = $state(true);
|
||||
let streamingQuality = $state('Hi-Res+');
|
||||
let outputDevice = $state('System Default');
|
||||
let exclusiveMode = $state(false);
|
||||
let dacPassthrough = $state(false);
|
||||
@@ -604,12 +603,6 @@
|
||||
streamingQuality = savedQuality;
|
||||
}
|
||||
|
||||
// Load prefer highest setting
|
||||
const savedPreferHighest = localStorage.getItem('qbz-prefer-highest');
|
||||
if (savedPreferHighest !== null) {
|
||||
preferHighest = savedPreferHighest === 'true';
|
||||
}
|
||||
|
||||
// Load language setting from i18n locale
|
||||
const currentLocale = get(locale);
|
||||
if (currentLocale && localeToLanguage[currentLocale]) {
|
||||
@@ -954,14 +947,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
function handleQualityChange(quality: string) {
|
||||
async function handleQualityChange(quality: string) {
|
||||
const previousQuality = streamingQuality;
|
||||
streamingQuality = quality;
|
||||
localStorage.setItem('qbz-streaming-quality', quality);
|
||||
}
|
||||
|
||||
function handlePreferHighestChange(enabled: boolean) {
|
||||
preferHighest = enabled;
|
||||
localStorage.setItem('qbz-prefer-highest', String(enabled));
|
||||
// Clear playback cache when quality changes (issue #34)
|
||||
// This ensures cached tracks don't play at wrong quality
|
||||
// Important for users with hardware sample rate limitations
|
||||
if (previousQuality !== quality) {
|
||||
try {
|
||||
await invoke('clear_cache');
|
||||
await loadCacheStats();
|
||||
showToast($t('settings.audio.qualityChangedCacheCleared'), 'success');
|
||||
} catch (err) {
|
||||
console.error('Failed to clear cache after quality change:', err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Offline mode handlers
|
||||
@@ -1902,17 +1904,16 @@
|
||||
<section class="section" bind:this={audioSection}>
|
||||
<h3 class="section-title">{$t('settings.audio.title')}</h3>
|
||||
<div class="setting-row">
|
||||
<span class="setting-label">{$t('settings.audio.streamingQuality')}</span>
|
||||
<div class="setting-info">
|
||||
<span class="setting-label">{$t('settings.audio.streamingQuality')}</span>
|
||||
<span class="setting-desc">{$t('settings.audio.streamingQualityDesc')}</span>
|
||||
</div>
|
||||
<Dropdown
|
||||
value={streamingQuality}
|
||||
options={['MP3', 'CD Quality', 'Hi-Res', 'Hi-Res+']}
|
||||
onchange={handleQualityChange}
|
||||
/>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<span class="setting-label">{$t('settings.audio.preferHighest')}</span>
|
||||
<Toggle enabled={preferHighest} onchange={handlePreferHighestChange} />
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<div class="setting-info">
|
||||
<span class="setting-label">Audio Backend</span>
|
||||
|
||||
@@ -360,8 +360,8 @@
|
||||
"audio": {
|
||||
"title": "Audio",
|
||||
"streamingQuality": "Streaming Quality",
|
||||
"preferHighest": "Prefer Highest Available",
|
||||
"preferHighestDesc": "Automatically select highest quality for your subscription",
|
||||
"streamingQualityDesc": "Maximum quality for streaming and playback cache",
|
||||
"qualityChangedCacheCleared": "Quality changed. Playback cache cleared.",
|
||||
"outputDevice": "Output Device",
|
||||
"audioDevice": "Audio Device",
|
||||
"exclusiveMode": "Exclusive Mode",
|
||||
|
||||
@@ -360,8 +360,8 @@
|
||||
"audio": {
|
||||
"title": "Audio",
|
||||
"streamingQuality": "Calidad de Streaming",
|
||||
"preferHighest": "Preferir Máxima Calidad",
|
||||
"preferHighestDesc": "Seleccionar automáticamente la mejor calidad para tu suscripción",
|
||||
"streamingQualityDesc": "Calidad máxima para streaming y caché de reproducción",
|
||||
"qualityChangedCacheCleared": "Calidad cambiada. Caché de reproducción limpiado.",
|
||||
"outputDevice": "Dispositivo de Salida",
|
||||
"audioDevice": "Dispositivo de Audio",
|
||||
"exclusiveMode": "Modo Exclusivo",
|
||||
|
||||
Reference in new issue
Block a user