From 44dc05a87a5fd20fca392f5f5fad5debe0b6fb92 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Tue, 7 Dec 2010 20:29:13 +0000 Subject: [PATCH] Don't stop the track when it's about to end if crossfading is enabled but fadeout is disabled. Fixes issue #1040 --- src/core/player.cpp | 7 +++++++ src/engines/enginebase.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/core/player.cpp b/src/core/player.cpp index 224fc495e..78521e12e 100644 --- a/src/core/player.cpp +++ b/src/core/player.cpp @@ -423,6 +423,13 @@ void Player::TrackAboutToEnd() { if (engine_->is_autocrossfade_enabled()) { // Crossfade is on, so just start playing the next track. The current one // will fade out, and the new one will fade in + + // But, if there's no next track and we don't want to fade out, then do + // nothing and just let the track finish to completion. + if (!engine_->is_fadeout_enabled() && + playlists_->active()->next_index() == -1) + return; + NextInternal(Engine::Auto); } else { // Crossfade is off, so start preloading the next track so we don't get a diff --git a/src/engines/enginebase.h b/src/engines/enginebase.h index 15a41397d..9cd23aea6 100644 --- a/src/engines/enginebase.h +++ b/src/engines/enginebase.h @@ -69,6 +69,7 @@ class Base : public QObject, boost::noncopyable { // Simple accessors inline uint volume() const { return volume_; } virtual const Scope &scope() { return scope_; } + bool is_fadeout_enabled() const { return fadeout_enabled_; } bool is_crossfade_enabled() const { return crossfade_enabled_; } bool is_autocrossfade_enabled() const { return autocrossfade_enabled_; }