fix: gapless toggle now actually controls audio output lifecycle

When gapless is off, the AudioOutput is dropped after each track ends
naturally, producing a real gap on the next play. When on, the output
stays alive so tracks transition seamlessly. Also re-adds URL prefetch
gating behind the same toggle.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
joren
2026-03-24 11:39:24 +01:00
parent c035ce2dee
commit 1e4c234b5c
9 changed files with 31 additions and 3 deletions

View File

@@ -160,6 +160,7 @@ MainWindow::MainWindow(QobuzBackend *backend, QWidget *parent)
// Apply playback options from saved settings
m_backend->setReplayGain(AppSettings::instance().replayGainEnabled());
m_backend->setGapless(AppSettings::instance().gaplessEnabled());
tryRestoreSession();
}
@@ -269,8 +270,8 @@ void MainWindow::onTrackChanged(const QJsonObject &track)
statusBar()->showMessage(
artist.isEmpty() ? title : QStringLiteral("▶ %1 — %2").arg(artist, title));
// Prefetch next track URL to minimise the gap between tracks
if (m_queue->canGoNext()) {
// Prefetch next track URL when gapless is enabled
if (AppSettings::instance().gaplessEnabled() && m_queue->canGoNext()) {
const auto upcoming = m_queue->upcomingTracks(1);
if (!upcoming.isEmpty()) {
const qint64 nextId = static_cast<qint64>(upcoming.first()["id"].toDouble());