From f1c65e553842242331ea4378f14c8396a2fca38f Mon Sep 17 00:00:00 2001 From: ronso0 Date: Thu, 22 Oct 2020 02:07:22 +0200 Subject: [PATCH 1/2] add group,CloneFromSampler control --- src/mixer/basetrackplayer.cpp | 16 ++++++++++++++++ src/mixer/basetrackplayer.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/src/mixer/basetrackplayer.cpp b/src/mixer/basetrackplayer.cpp index ebd7b70fd32..88d23e2630f 100644 --- a/src/mixer/basetrackplayer.cpp +++ b/src/mixer/basetrackplayer.cpp @@ -107,6 +107,15 @@ BaseTrackPlayerImpl::BaseTrackPlayerImpl(QObject* pParent, this, &BaseTrackPlayerImpl::slotCloneFromDeck); + // Sampler cloning + m_pCloneFromSampler = std::make_unique( + ConfigKey(getGroup(), "CloneFromSampler"), + false); + connect(m_pCloneFromSampler.get(), + &ControlObject::valueChanged, + this, + &BaseTrackPlayerImpl::slotCloneFromSampler); + // Waveform controls // This acts somewhat like a ControlPotmeter, but the normal _up/_down methods // do not work properly with this CO. @@ -548,6 +557,13 @@ void BaseTrackPlayerImpl::slotCloneFromDeck(double d) { } } +void BaseTrackPlayerImpl::slotCloneFromSampler(double d) { + int sampler = std::lround(d); + if (sampler >= 1) { + slotCloneFromGroup(PlayerManager::groupForSampler(sampler-1)); + } +} + void BaseTrackPlayerImpl::slotCloneChannel(EngineChannel* pChannel) { // don't clone from ourselves if (pChannel == m_pChannel) { diff --git a/src/mixer/basetrackplayer.h b/src/mixer/basetrackplayer.h index 906a26d428e..05ce9ed6cd8 100644 --- a/src/mixer/basetrackplayer.h +++ b/src/mixer/basetrackplayer.h @@ -90,6 +90,7 @@ class BaseTrackPlayerImpl : public BaseTrackPlayer { private slots: void slotCloneChannel(EngineChannel* pChannel); void slotCloneFromDeck(double deck); + void slotCloneFromSampler(double sampler); void slotTrackColorChangeRequest(double value); void slotVinylControlEnabled(double v); void slotWaveformZoomValueChangeRequest(double pressed); @@ -117,6 +118,7 @@ class BaseTrackPlayerImpl : public BaseTrackPlayer { // Deck clone control std::unique_ptr m_pCloneFromDeck; + std::unique_ptr m_pCloneFromSampler; // Track color control std::unique_ptr m_pTrackColor; From 76ed0ae58c7410f471328279841839702f7b4758 Mon Sep 17 00:00:00 2001 From: ronso0 Date: Thu, 22 Oct 2020 13:32:34 +0200 Subject: [PATCH 2/2] Basetrackplayer clone: use static_cast instead of lround --- src/mixer/basetrackplayer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mixer/basetrackplayer.cpp b/src/mixer/basetrackplayer.cpp index 88d23e2630f..6bac39dd2fe 100644 --- a/src/mixer/basetrackplayer.cpp +++ b/src/mixer/basetrackplayer.cpp @@ -549,18 +549,18 @@ void BaseTrackPlayerImpl::slotCloneFromGroup(const QString& group) { } void BaseTrackPlayerImpl::slotCloneFromDeck(double d) { - int deck = std::lround(d); + int deck = static_cast(d); if (deck < 1) { slotCloneDeck(); } else { - slotCloneFromGroup(PlayerManager::groupForDeck(deck-1)); + slotCloneFromGroup(PlayerManager::groupForDeck(deck - 1)); } } void BaseTrackPlayerImpl::slotCloneFromSampler(double d) { - int sampler = std::lround(d); + int sampler = static_cast(d); if (sampler >= 1) { - slotCloneFromGroup(PlayerManager::groupForSampler(sampler-1)); + slotCloneFromGroup(PlayerManager::groupForSampler(sampler - 1)); } }