diff --git a/res/controllers/Numark-Mixtrack-Platinum-scripts.js b/res/controllers/Numark-Mixtrack-Platinum-scripts.js index 31f91290b9b..3d8cb363689 100644 --- a/res/controllers/Numark-Mixtrack-Platinum-scripts.js +++ b/res/controllers/Numark-Mixtrack-Platinum-scripts.js @@ -1230,7 +1230,7 @@ MixtrackPlatinum.scratchEnable = function (deck) { var alpha = 1.0/8; var beta = alpha/32; - engine.scratchEnable(deck, 1011, 33+1/3, alpha, beta); + engine.scratchEnable(deck, 1240, 33+1/3, alpha, beta); MixtrackPlatinum.stopScratchTimer(deck); }; diff --git a/src/engine/channels/enginedeck.cpp b/src/engine/channels/enginedeck.cpp index 2d0e34aeeec..c78badec17d 100644 --- a/src/engine/channels/enginedeck.cpp +++ b/src/engine/channels/enginedeck.cpp @@ -44,6 +44,12 @@ EngineDeck::EngineDeck(const ChannelHandleAndGroup& handle_group, m_bPassthroughIsActive = false; m_bPassthroughWasActive = false; + // Ensure that input is configured before enabling passthrough + m_pPassing->connectValueChangeRequest( + this, + &EngineDeck::slotPassthroughChangeRequest, + Qt::DirectConnection); + // Set up passthrough toggle button connect(m_pPassing, &ControlObject::valueChanged, this, &EngineDeck::slotPassingToggle, @@ -163,3 +169,11 @@ 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); + } else { + emit noPassthroughInputConfigured(); + } +} diff --git a/src/engine/channels/enginedeck.h b/src/engine/channels/enginedeck.h index 2e68486429e..293100bae57 100644 --- a/src/engine/channels/enginedeck.h +++ b/src/engine/channels/enginedeck.h @@ -73,8 +73,12 @@ 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); private: UserSettingsPointer m_pConfig; diff --git a/src/mixer/basetrackplayer.cpp b/src/mixer/basetrackplayer.cpp index a133dc0918e..e18a0355af1 100644 --- a/src/mixer/basetrackplayer.cpp +++ b/src/mixer/basetrackplayer.cpp @@ -46,8 +46,6 @@ BaseTrackPlayerImpl::BaseTrackPlayerImpl(QObject* pParent, pEffectsManager, defaultOrientation); m_pInputConfigured = std::make_unique(group, "input_configured", this); - m_pPassthroughEnabled = std::make_unique(group, "passthrough", this); - m_pPassthroughEnabled->connectValueChanged(this, &BaseTrackPlayerImpl::slotPassthroughEnabled); #ifdef __VINYLCONTROL__ m_pVinylControlEnabled = std::make_unique(group, "vinylcontrol_enabled", this); m_pVinylControlEnabled->connectValueChanged(this, &BaseTrackPlayerImpl::slotVinylControlEnabled); @@ -499,18 +497,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 80ad4115ade..8dbc31abc66 100644 --- a/src/mixer/basetrackplayer.h +++ b/src/mixer/basetrackplayer.h @@ -45,7 +45,6 @@ class BaseTrackPlayer : public BasePlayer { void newTrackLoaded(TrackPointer pLoadedTrack); void loadingTrack(TrackPointer pNewTrack, TrackPointer pOldTrack); void playerEmpty(); - void noPassthroughInputConfigured(); void noVinylControlInputConfigured(); }; @@ -86,7 +85,6 @@ class BaseTrackPlayerImpl : public BaseTrackPlayer { private slots: void slotCloneChannel(EngineChannel* pChannel); void slotCloneFromDeck(double deck); - void slotPassthroughEnabled(double v); void slotVinylControlEnabled(double v); void slotWaveformZoomValueChangeRequest(double pressed); void slotWaveformZoomUp(double pressed); @@ -140,7 +138,6 @@ class BaseTrackPlayerImpl : public BaseTrackPlayer { std::unique_ptr m_pRateRatio; 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; }; diff --git a/src/mixer/playermanager.cpp b/src/mixer/playermanager.cpp index 867ad70a458..3ce943786d4 100644 --- a/src/mixer/playermanager.cpp +++ b/src/mixer/playermanager.cpp @@ -370,8 +370,10 @@ void PlayerManager::addDeckInner() { Deck* pDeck = new Deck(this, m_pConfig, m_pEngine, m_pEffectsManager, m_pVisualsManager, orientation, group); - connect(pDeck, SIGNAL(noPassthroughInputConfigured()), - this, SIGNAL(noDeckPassthroughInputConfigured())); + connect(pDeck->getEngineDeck(), + &EngineDeck::noPassthroughInputConfigured, + this, + &PlayerManager::noDeckPassthroughInputConfigured); connect(pDeck, SIGNAL(noVinylControlInputConfigured()), this, SIGNAL(noVinylControlInputConfigured())); diff --git a/src/widget/wtracktableview.cpp b/src/widget/wtracktableview.cpp index ecaf9933e93..e72824cfea0 100644 --- a/src/widget/wtracktableview.cpp +++ b/src/widget/wtracktableview.cpp @@ -599,11 +599,9 @@ void WTrackTableView::slotMouseDoubleClicked(const QModelIndex &index) { } TrackPointer pTrack = trackModel->getTrack(index); - VERIFY_OR_DEBUG_ASSERT(pTrack) { - return; + if (pTrack) { + emit loadTrack(pTrack); } - - emit loadTrack(pTrack); } else if (doubleClickAction == DlgPrefLibrary::ADD_TO_AUTODJ_BOTTOM && modelHasCapabilities(TrackModel::TRACKMODELCAPS_ADDTOAUTODJ)) { addToAutoDJ(PlaylistDAO::AutoDJSendLoc::BOTTOM); @@ -1959,13 +1957,11 @@ void WTrackTableView::slotScaleBpm(int scale) { const QModelIndexList selectedTrackIndices = selectionModel()->selectedRows(); for (const auto& index : selectedTrackIndices) { - TrackPointer track = trackModel->getTrack(index); - if (!track->isBpmLocked()) { // bpm is not locked - BeatsPointer beats = track->getBeats(); - if (beats != nullptr) { - beats->scale(static_cast(scale)); - } else { - continue; + TrackPointer pTrack = trackModel->getTrack(index); + if (pTrack && !pTrack->isBpmLocked()) { + BeatsPointer pBeats = pTrack->getBeats(); + if (pBeats) { + pBeats->scale(static_cast(scale)); } } } @@ -1980,8 +1976,10 @@ void WTrackTableView::lockBpm(bool lock) { const QModelIndexList selectedTrackIndices = selectionModel()->selectedRows(); // TODO: This should be done in a thread for large selections for (const auto& index : selectedTrackIndices) { - TrackPointer track = trackModel->getTrack(index); - track->setBpmLocked(lock); + TrackPointer pTrack = trackModel->getTrack(index); + if (pTrack) { + pTrack->setBpmLocked(lock); + } } } @@ -2012,9 +2010,9 @@ void WTrackTableView::slotClearBeats() { const QModelIndexList selectedTrackIndices = selectionModel()->selectedRows(); // TODO: This should be done in a thread for large selections for (const auto& index : selectedTrackIndices) { - TrackPointer track = trackModel->getTrack(index); - if (!track->isBpmLocked()) { - track->setBeats(BeatsPointer()); + TrackPointer pTrack = trackModel->getTrack(index); + if (pTrack && !pTrack->isBpmLocked()) { + pTrack->setBeats(BeatsPointer()); } } }