From 9d66c636e6fe9ebe6a5f6bbe811ce359bd84b322 Mon Sep 17 00:00:00 2001 From: Be Date: Tue, 20 Aug 2019 09:18:32 -0500 Subject: move workaround for AutoDJ cloning decks to PlayerManager --- src/mixer/playermanager.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/mixer/playermanager.cpp') diff --git a/src/mixer/playermanager.cpp b/src/mixer/playermanager.cpp index e73bf8e6f5..b03728d0f1 100644 --- a/src/mixer/playermanager.cpp +++ b/src/mixer/playermanager.cpp @@ -65,7 +65,8 @@ PlayerManager::PlayerManager(UserSettingsPointer pConfig, ConfigKey("[Master]", "num_microphones"), true, true)), m_pCONumAuxiliaries(new ControlObject( ConfigKey("[Master]", "num_auxiliaries"), true, true)), - m_pTrackAnalysisScheduler(TrackAnalysisScheduler::NullPointer()) { + m_pTrackAnalysisScheduler(TrackAnalysisScheduler::NullPointer()), + m_pAutoDjEnabled(std::make_unique("[AutoDJ]", "enabled", this)) { m_pCONumDecks->connectValueChangeRequest(this, &PlayerManager::slotChangeNumDecks, Qt::DirectConnection); m_pCONumSamplers->connectValueChangeRequest(this, @@ -584,7 +585,21 @@ void PlayerManager::slotLoadTrackToPlayer(TrackPointer pTrack, QString group, bo // If not present in the config, use & set the default value bool cloneOnDoubleTap = m_pConfig->getValue( ConfigKey("[Controls]", "CloneDeckOnLoadDoubleTap"), kDefaultCloneDeckOnLoad); - if (cloneOnDoubleTap && m_lastLoadedPlayer == group && elapsed < mixxx::Duration::fromSeconds(0.5)) { + + // If AutoDJ is enabled, prevent it from cloning decks if the same track + // is in the AutoDJ queue twice in a row. This can happen when the option to + // repeat the AutoDJ queue is enabled and the user presses the "Skip now" + // button repeatedly. + // AutoDJProcessor is initialized after PlayerManager, so check that the + // ControlProxy is pointing to the real ControlObject. + if (!m_pAutoDjEnabled->valid()) { + m_pAutoDjEnabled->initialize(ConfigKey("[AutoDJ]", "enabled")); + } + bool autoDjSkipClone = m_pAutoDjEnabled->get() && (pPlayer == m_decks.at(0) || pPlayer == m_decks.at(1)); + + if (cloneOnDoubleTap && m_lastLoadedPlayer == group + && elapsed < mixxx::Duration::fromSeconds(0.5) + && !autoDjSkipClone) { // load was pressed twice quickly while [Controls],CloneDeckOnLoadDoubleTap is TRUE, // so clone another playing deck instead of loading the selected track pPlayer->slotCloneDeck(); -- cgit v1.2.3 From 200396600c6394afeea77236f284e9aa186b2b63 Mon Sep 17 00:00:00 2001 From: Be Date: Mon, 14 Oct 2019 12:34:02 -0500 Subject: use parented_ptr for ControlProxy --- src/mixer/playermanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mixer/playermanager.cpp') diff --git a/src/mixer/playermanager.cpp b/src/mixer/playermanager.cpp index b03728d0f1..b71ddc7ada 100644 --- a/src/mixer/playermanager.cpp +++ b/src/mixer/playermanager.cpp @@ -66,7 +66,7 @@ PlayerManager::PlayerManager(UserSettingsPointer pConfig, m_pCONumAuxiliaries(new ControlObject( ConfigKey("[Master]", "num_auxiliaries"), true, true)), m_pTrackAnalysisScheduler(TrackAnalysisScheduler::NullPointer()), - m_pAutoDjEnabled(std::make_unique("[AutoDJ]", "enabled", this)) { + m_pAutoDjEnabled(make_parented("[AutoDJ]", "enabled", this)) { m_pCONumDecks->connectValueChangeRequest(this, &PlayerManager::slotChangeNumDecks, Qt::DirectConnection); m_pCONumSamplers->connectValueChangeRequest(this, -- cgit v1.2.3 From 3d7320b6958f90b32136844241b2ac87b058dafb Mon Sep 17 00:00:00 2001 From: Be Date: Mon, 14 Oct 2019 12:34:59 -0500 Subject: PlayerManager: fix initialization order --- src/mixer/playermanager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mixer/playermanager.cpp') diff --git a/src/mixer/playermanager.cpp b/src/mixer/playermanager.cpp index b71ddc7ada..5240f71210 100644 --- a/src/mixer/playermanager.cpp +++ b/src/mixer/playermanager.cpp @@ -65,8 +65,8 @@ PlayerManager::PlayerManager(UserSettingsPointer pConfig, ConfigKey("[Master]", "num_microphones"), true, true)), m_pCONumAuxiliaries(new ControlObject( ConfigKey("[Master]", "num_auxiliaries"), true, true)), - m_pTrackAnalysisScheduler(TrackAnalysisScheduler::NullPointer()), - m_pAutoDjEnabled(make_parented("[AutoDJ]", "enabled", this)) { + m_pAutoDjEnabled(make_parented("[AutoDJ]", "enabled", this)), + m_pTrackAnalysisScheduler(TrackAnalysisScheduler::NullPointer()) { m_pCONumDecks->connectValueChangeRequest(this, &PlayerManager::slotChangeNumDecks, Qt::DirectConnection); m_pCONumSamplers->connectValueChangeRequest(this, -- cgit v1.2.3