Skip to content

Commit

Permalink
fixup! RateControl/PositionScratchController: use std::unique_ptr, Po…
Browse files Browse the repository at this point in the history
…llingControlProxy etc.
  • Loading branch information
ronso0 committed Dec 30, 2024
1 parent 54e2540 commit 9c033fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
15 changes: 3 additions & 12 deletions src/engine/positionscratchcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ PositionScratchController::PositionScratchController(const QString& group)
m_d(1),
m_f(0.4) {
m_pMainSampleRate->connectValueChanged(this,
&PositionScratchController::slotSampleRateChanged);
&PositionScratchController::slotUpdateFilterParameters);
}

PositionScratchController::~PositionScratchController() {
}

void PositionScratchController::slotSampleRateChanged(double sampleRate) {
void PositionScratchController::slotUpdateFilterParameters(double sampleRate) {
// VERIFY_OR_DEBUG_ASSERT(!util_isNan(m_bufferSize) && m_bufferSize > 0) {
// }
// The latency or time difference between process calls.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions src/engine/positionscratchcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9c033fa

Please sign in to comment.