From 0f5d4b358f023b7431009e13e6b9370794c759ab Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 2 Feb 2020 23:54:03 +0100 Subject: [PATCH 1/5] engine/enginedeck: Ensure that configured input before enabing passthru This avoids stopping the playing deck if no input is configured for passthrough. --- src/engine/enginedeck.cpp | 11 +++++++++++ src/engine/enginedeck.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/engine/enginedeck.cpp b/src/engine/enginedeck.cpp index 0304e055b76..11b2f5c79d4 100644 --- a/src/engine/enginedeck.cpp +++ b/src/engine/enginedeck.cpp @@ -44,6 +44,11 @@ EngineDeck::EngineDeck(const ChannelHandleAndGroup& handle_group, m_bPassthroughIsActive = false; m_bPassthroughWasActive = false; + // Ensure that input is configured before enabling passthrough + m_pPassing->connectValueChangeRequest( + this, SLOT(slotPassthroughChangeRequest(double)), + Qt::DirectConnection); + // Set up passthrough toggle button connect(m_pPassing, SIGNAL(valueChanged(double)), this, SLOT(slotPassingToggle(double)), @@ -163,3 +168,9 @@ bool EngineDeck::isPassthroughActive() const { void EngineDeck::slotPassingToggle(double v) { m_bPassthroughIsActive = v > 0; } + +void EngineDeck::slotPassthroughChangeRequest(double v) { + if (v <= 0 || m_pInputConfigured->get() > 0) { + m_pPassing->setAndConfirm(v); + } +} diff --git a/src/engine/enginedeck.h b/src/engine/enginedeck.h index 2480cc715bc..702a77ae300 100644 --- a/src/engine/enginedeck.h +++ b/src/engine/enginedeck.h @@ -75,6 +75,7 @@ class EngineDeck : public EngineChannel, public AudioDestination { public slots: void slotPassingToggle(double v); + void slotPassthroughChangeRequest(double v); private: UserSettingsPointer m_pConfig; From 30674ab04d1c8de320792a7dd6794db5eec423a9 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 2 Feb 2020 23:55:29 +0100 Subject: [PATCH 2/5] engine/enginedeck: Reenable popup when activating unconfigured passthru --- src/engine/enginedeck.cpp | 2 ++ src/engine/enginedeck.h | 3 +++ src/mixer/basetrackplayer.cpp | 2 ++ 3 files changed, 7 insertions(+) diff --git a/src/engine/enginedeck.cpp b/src/engine/enginedeck.cpp index 11b2f5c79d4..6cf38a9a161 100644 --- a/src/engine/enginedeck.cpp +++ b/src/engine/enginedeck.cpp @@ -172,5 +172,7 @@ void EngineDeck::slotPassingToggle(double v) { void EngineDeck::slotPassthroughChangeRequest(double v) { if (v <= 0 || m_pInputConfigured->get() > 0) { m_pPassing->setAndConfirm(v); + } else { + emit(noPassthroughInputConfigured()); } } diff --git a/src/engine/enginedeck.h b/src/engine/enginedeck.h index 702a77ae300..25ba1fe553b 100644 --- a/src/engine/enginedeck.h +++ b/src/engine/enginedeck.h @@ -73,6 +73,9 @@ class EngineDeck : public EngineChannel, public AudioDestination { // Return whether or not passthrough is active bool isPassthroughActive() const; + signals: + void noPassthroughInputConfigured(); + public slots: void slotPassingToggle(double v); void slotPassthroughChangeRequest(double v); diff --git a/src/mixer/basetrackplayer.cpp b/src/mixer/basetrackplayer.cpp index 118803683c8..7b06daabbc6 100644 --- a/src/mixer/basetrackplayer.cpp +++ b/src/mixer/basetrackplayer.cpp @@ -41,6 +41,8 @@ BaseTrackPlayerImpl::BaseTrackPlayerImpl(QObject* pParent, pMixingEngine->registerChannelGroup(group); m_pChannel = new EngineDeck(channelGroup, pConfig, pMixingEngine, pEffectsManager, defaultOrientation); + connect(m_pChannel, &EngineDeck::noPassthroughInputConfigured, + [this]{ emit(noPassthroughInputConfigured()); }); m_pInputConfigured = std::make_unique(group, "input_configured", this); m_pPassthroughEnabled = std::make_unique(group, "passthrough", this); From ec4c3ad84900e9b645cdd62bddbae2b989443fd2 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Mon, 3 Feb 2020 00:56:57 +0100 Subject: [PATCH 3/5] mixer/basetrackplayer: Remove obsolete passthrough enabled handling --- src/mixer/basetrackplayer.cpp | 14 -------------- src/mixer/basetrackplayer.h | 2 -- 2 files changed, 16 deletions(-) diff --git a/src/mixer/basetrackplayer.cpp b/src/mixer/basetrackplayer.cpp index 7b06daabbc6..364b1fa55d1 100644 --- a/src/mixer/basetrackplayer.cpp +++ b/src/mixer/basetrackplayer.cpp @@ -45,8 +45,6 @@ BaseTrackPlayerImpl::BaseTrackPlayerImpl(QObject* pParent, [this]{ emit(noPassthroughInputConfigured()); }); m_pInputConfigured = std::make_unique(group, "input_configured", this); - m_pPassthroughEnabled = std::make_unique(group, "passthrough", this); - m_pPassthroughEnabled->connectValueChanged(SLOT(slotPassthroughEnabled(double))); #ifdef __VINYLCONTROL__ m_pVinylControlEnabled = std::make_unique(group, "vinylcontrol_enabled", this); m_pVinylControlEnabled->connectValueChanged(SLOT(slotVinylControlEnabled(double))); @@ -410,18 +408,6 @@ void BaseTrackPlayerImpl::setupEqControls() { m_pPitchAdjust = std::make_unique(group, "pitch_adjust", this); } -void BaseTrackPlayerImpl::slotPassthroughEnabled(double v) { - bool configured = m_pInputConfigured->toBool(); - bool passthrough = v > 0.0; - - // Warn the user if they try to enable passthrough on a player with no - // configured input. - if (!configured && passthrough) { - m_pPassthroughEnabled->set(0.0); - emit(noPassthroughInputConfigured()); - } -} - void BaseTrackPlayerImpl::slotVinylControlEnabled(double v) { #ifdef __VINYLCONTROL__ bool configured = m_pInputConfigured->toBool(); diff --git a/src/mixer/basetrackplayer.h b/src/mixer/basetrackplayer.h index ccff53a71ff..cf49f23bc8a 100644 --- a/src/mixer/basetrackplayer.h +++ b/src/mixer/basetrackplayer.h @@ -78,7 +78,6 @@ class BaseTrackPlayerImpl : public BaseTrackPlayer { void slotPlayToggled(double); private slots: - void slotPassthroughEnabled(double v); void slotVinylControlEnabled(double v); void slotWaveformZoomValueChangeRequest(double pressed); void slotWaveformZoomUp(double pressed); @@ -129,7 +128,6 @@ class BaseTrackPlayerImpl : public BaseTrackPlayer { std::unique_ptr m_pRateSlider; std::unique_ptr m_pPitchAdjust; std::unique_ptr m_pInputConfigured; - std::unique_ptr m_pPassthroughEnabled; std::unique_ptr m_pVinylControlEnabled; std::unique_ptr m_pVinylControlStatus; }; From 4cd2942a20e31343dee81c719ea70b567a45d196 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Mon, 3 Feb 2020 00:59:16 +0100 Subject: [PATCH 4/5] engine/enginedeck: Fix clazy warning regarding emit parentheses --- src/engine/enginedeck.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/enginedeck.cpp b/src/engine/enginedeck.cpp index 6cf38a9a161..579ad6b3c04 100644 --- a/src/engine/enginedeck.cpp +++ b/src/engine/enginedeck.cpp @@ -173,6 +173,6 @@ void EngineDeck::slotPassthroughChangeRequest(double v) { if (v <= 0 || m_pInputConfigured->get() > 0) { m_pPassing->setAndConfirm(v); } else { - emit(noPassthroughInputConfigured()); + emit noPassthroughInputConfigured(); } } From bed4a876d8f37ce11896b3b610f1a0acbe2ff0b9 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Mon, 3 Feb 2020 01:06:41 +0100 Subject: [PATCH 5/5] mixer: Connect noPassthroughInputConfigured directly via EngineDeck --- src/mixer/basetrackplayer.cpp | 2 -- src/mixer/basetrackplayer.h | 1 - src/mixer/playermanager.cpp | 4 ++-- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/mixer/basetrackplayer.cpp b/src/mixer/basetrackplayer.cpp index 364b1fa55d1..791a2fc3026 100644 --- a/src/mixer/basetrackplayer.cpp +++ b/src/mixer/basetrackplayer.cpp @@ -41,8 +41,6 @@ BaseTrackPlayerImpl::BaseTrackPlayerImpl(QObject* pParent, pMixingEngine->registerChannelGroup(group); m_pChannel = new EngineDeck(channelGroup, pConfig, pMixingEngine, pEffectsManager, defaultOrientation); - connect(m_pChannel, &EngineDeck::noPassthroughInputConfigured, - [this]{ emit(noPassthroughInputConfigured()); }); m_pInputConfigured = std::make_unique(group, "input_configured", this); #ifdef __VINYLCONTROL__ diff --git a/src/mixer/basetrackplayer.h b/src/mixer/basetrackplayer.h index cf49f23bc8a..57a3c862fcd 100644 --- a/src/mixer/basetrackplayer.h +++ b/src/mixer/basetrackplayer.h @@ -42,7 +42,6 @@ class BaseTrackPlayer : public BasePlayer { void newTrackLoaded(TrackPointer pLoadedTrack); void loadingTrack(TrackPointer pNewTrack, TrackPointer pOldTrack); void playerEmpty(); - void noPassthroughInputConfigured(); void noVinylControlInputConfigured(); }; diff --git a/src/mixer/playermanager.cpp b/src/mixer/playermanager.cpp index 97c1aa55be0..bf43a00e05d 100644 --- a/src/mixer/playermanager.cpp +++ b/src/mixer/playermanager.cpp @@ -365,8 +365,8 @@ void PlayerManager::addDeckInner() { Deck* pDeck = new Deck(this, m_pConfig, m_pEngine, m_pEffectsManager, orientation, group); - connect(pDeck, SIGNAL(noPassthroughInputConfigured()), - this, SIGNAL(noDeckPassthroughInputConfigured())); + connect(pDeck->getEngineDeck(), &EngineDeck::noPassthroughInputConfigured, + this, &PlayerManager::noDeckPassthroughInputConfigured); connect(pDeck, SIGNAL(noVinylControlInputConfigured()), this, SIGNAL(noVinylControlInputConfigured()));