From df3c7b814fbc78369c7bb8d8836e80b2a52dd0df Mon Sep 17 00:00:00 2001 From: ronso0 Date: Mon, 30 Dec 2024 19:46:12 +0100 Subject: [PATCH] fixup! RateControl/PositionScratchController: use std::unique_ptr, PollingControlProxy etc. --- src/engine/positionscratchcontroller.cpp | 13 ++----------- src/engine/positionscratchcontroller.h | 11 ++++++++--- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/engine/positionscratchcontroller.cpp b/src/engine/positionscratchcontroller.cpp index 16f7a9eb98e..fb39b709349 100644 --- a/src/engine/positionscratchcontroller.cpp +++ b/src/engine/positionscratchcontroller.cpp @@ -106,7 +106,7 @@ PositionScratchController::PositionScratchController(const QString& group) m_d(1), m_f(0.4) { m_pMainSampleRate->connectValueChanged(this, - &PositionScratchController::slotSampleRateChanged); + &PositionScratchController::slotUpdateFilterParameters); } PositionScratchController::~PositionScratchController() { @@ -154,7 +154,7 @@ void PositionScratchController::process(double currentSamplePos, if (bufferSize != m_bufferSize) { m_bufferSize = bufferSize; - slotSampleRateChanged(m_pMainSampleRate->get()); + slotUpdateFilterParameters(m_pMainSampleRate->get()); } double scratchPosition = 0; @@ -313,15 +313,6 @@ void PositionScratchController::process(double currentSamplePos, m_prevSamplePos = currentSamplePos; } -bool PositionScratchController::isEnabled() { - // return true only if m_rate is valid. - return m_isScratching; -} - -double PositionScratchController::getRate() { - return m_rate; -} - void PositionScratchController::notifySeek(mixxx::audio::FramePos position) { DEBUG_ASSERT(position.isValid()); // scratching continues after seek due to calculating the relative distance traveled diff --git a/src/engine/positionscratchcontroller.h b/src/engine/positionscratchcontroller.h index b91b98ce2cb..b77beff0e42 100644 --- a/src/engine/positionscratchcontroller.h +++ b/src/engine/positionscratchcontroller.h @@ -25,12 +25,17 @@ class PositionScratchController : public QObject { int wrappedAround, mixxx::audio::FramePos trigger, mixxx::audio::FramePos target); - bool isEnabled(); - double getRate(); + bool isEnabled() { + // TODO return true only if m_rate is valid. + return m_isScratching; + } + double getRate() { + return m_rate; + } void notifySeek(mixxx::audio::FramePos position); private slots: - void slotSampleRateChanged(double sampleRate); + void slotUpdateFilterParameters(double sampleRate); private: const QString m_group;