diff --git a/src/engine/controls/bpmcontrol.cpp b/src/engine/controls/bpmcontrol.cpp index c2baca7c263d..828e3f4950af 100644 --- a/src/engine/controls/bpmcontrol.cpp +++ b/src/engine/controls/bpmcontrol.cpp @@ -927,11 +927,6 @@ void BpmControl::slotUpdateRateSlider(double value) { m_pRateRatio->set(dRateRatio); } -void BpmControl::notifySeek(double dNewPlaypos) { - EngineControl::notifySeek(dNewPlaypos); - updateBeatDistance(); -} - // called from an engine worker thread void BpmControl::trackLoaded(TrackPointer pNewTrack) { mixxx::BeatsPointer pBeats; diff --git a/src/engine/controls/bpmcontrol.h b/src/engine/controls/bpmcontrol.h index d191f77ef73c..f3a3f8915dae 100644 --- a/src/engine/controls/bpmcontrol.h +++ b/src/engine/controls/bpmcontrol.h @@ -79,7 +79,6 @@ class BpmControl : public EngineControl { static double shortestPercentageChange(const double& current_percentage, const double& target_percentage); double getRateRatio() const; - void notifySeek(double dNewPlaypos) override; void trackLoaded(TrackPointer pNewTrack) override; void trackBeatsUpdated(mixxx::BeatsPointer pBeats) override; diff --git a/src/engine/controls/enginecontrol.cpp b/src/engine/controls/enginecontrol.cpp index a5d0a0555f27..c709530d5b0a 100644 --- a/src/engine/controls/enginecontrol.cpp +++ b/src/engine/controls/enginecontrol.cpp @@ -47,7 +47,9 @@ void EngineControl::setEngineBuffer(EngineBuffer* pEngineBuffer) { } void EngineControl::setCurrentSample( - const double dCurrentSample, const double dTotalSamples, const double dTrackSampleRate) { + const double dCurrentSample, + const double dTotalSamples, + const double dTrackSampleRate) { SampleOfTrack sot; sot.current = dCurrentSample; sot.total = dTotalSamples; @@ -89,12 +91,6 @@ void EngineControl::seek(double sample) { } } -void EngineControl::notifySeek(double dNewPlaypos) { - SampleOfTrack sot = m_sampleOfTrack.getValue(); - sot.current = dNewPlaypos; - m_sampleOfTrack.setValue(sot); -} - EngineBuffer* EngineControl::pickSyncTarget() { EngineMaster* pMaster = getEngineMaster(); if (!pMaster) { diff --git a/src/engine/controls/enginecontrol.h b/src/engine/controls/enginecontrol.h index 1fe3371e5e5d..bf58379c43fb 100644 --- a/src/engine/controls/enginecontrol.h +++ b/src/engine/controls/enginecontrol.h @@ -1,8 +1,4 @@ -// enginecontrol.h -// Created 7/5/2009 by RJ Ryan (rryan@mit.edu) - -#ifndef ENGINECONTROL_H -#define ENGINECONTROL_H +#pragma once #include @@ -21,54 +17,62 @@ class EngineBuffer; const int kNoTrigger = -1; -/** - * EngineControl is an abstract base class for objects which implement - * functionality pertaining to EngineBuffer. An EngineControl is meant to be a - * succinct implementation of a given EngineBuffer feature. Previously, - * EngineBuffer was an example of feature creep -- this is the result. - * - * When writing an EngineControl class, the following two properties hold: - * - * EngineControl::process will only be called during an EngineBuffer::process - * callback from the sound engine. This implies that any ControlObject accesses - * made in either of these methods are mutually exclusive, since one is - * exclusively in the call graph of the other. - */ +/// EngineControl is an abstract base class for objects which implement +/// functionality pertaining to EngineBuffer. An EngineControl is meant to be a +/// succinct implementation of a given EngineBuffer feature. class EngineControl : public QObject { Q_OBJECT public: - EngineControl(QString group, - UserSettingsPointer pConfig); - ~EngineControl() override; - - // Called by EngineBuffer::process every latency period. See the above - // comments for information about guarantees that hold during this call. An - // EngineControl can perform any upkeep operations that are necessary during - // this call. - virtual void process(const double dRate, - const double dCurrentSample, - const int iBufferSize); - - // hintReader allows the EngineControl to provide hints to the reader to - // indicate that the given portion of a song is a potential imminent seek - // target. - virtual void hintReader(HintVector* pHintList); + EngineControl(QString group, UserSettingsPointer pConfig); + QString getGroup() const; virtual void setEngineMaster(EngineMaster* pEngineMaster); void setEngineBuffer(EngineBuffer* pEngineBuffer); - virtual void setCurrentSample(const double dCurrentSample, - const double dTotalSamples, const double dTrackSampleRate); - QString getGroup() const; - // Called to collect player features for effects processing. + virtual void setCurrentSample( + const double dCurrentSample, + const double dTotalSamples, + const double dTrackSampleRate); + + /// Called whenever a seek occurs to allow the EngineControl to respond. + virtual void notifySeek(double dNewPlaypos) { + Q_UNUSED(dNewPlaypos); + }; + + /// Called by EngineBuffer::process every latency period. An EngineControl + /// can perform any necessary upkeep operations during this call. + /// + /// EngineControl::process will only be called during an + /// EngineBuffer::process callback from the sound engine. This implies that + /// any ControlObject accesses made in either of these methods are mutually + /// exclusive, since one is exclusively in the call graph of the other. + virtual void process( + const double dRate, + const double dCurrentSample, + const int iBufferSize) { + Q_UNUSED(dRate); + Q_UNUSED(dCurrentSample); + Q_UNUSED(iBufferSize); + }; + + /// Called to collect player features for effects processing virtual void collectFeatureState(GroupFeatureState* pGroupFeatures) const { Q_UNUSED(pGroupFeatures); } - // Called whenever a seek occurs to allow the EngineControl to respond. - virtual void notifySeek(double dNewPlaypos); - virtual void trackLoaded(TrackPointer pNewTrack); - virtual void trackBeatsUpdated(mixxx::BeatsPointer pBeats); + virtual void trackLoaded(TrackPointer pNewTrack) { + Q_UNUSED(pNewTrack); + } + virtual void trackBeatsUpdated(mixxx::BeatsPointer pBeats) { + Q_UNUSED(pBeats); + } + + /// hintReader allows the EngineControl to provide hints to the reader to + /// indicate that the given portion of a song is a potential imminent seek + /// target. + virtual void hintReader(HintVector* pHintList) { + Q_UNUSED(pHintList); + }; protected: struct SampleOfTrack { @@ -82,9 +86,9 @@ class EngineControl : public QObject { } void seek(double fractionalPosition); void seekAbs(double sample); - // Seek to an exact sample and don't allow quantizing adjustment. + /// Seek to an exact sample and don't allow quantizing adjustment. void seekExact(double sample); - // Returns an EngineBuffer to target for syncing. Returns nullptr if none found + /// Returns an EngineBuffer to target for syncing. Returns nullptr if none found EngineBuffer* pickSyncTarget(); UserSettingsPointer getConfig(); @@ -108,5 +112,3 @@ class EngineControl : public QObject { FRIEND_TEST(LoopingControlTest, LoopResizeSeek); FRIEND_TEST(LoopingControlTest, Beatjump_JumpsByBeats); }; - -#endif /* ENGINECONTROL_H */ diff --git a/src/engine/controls/loopingcontrol.cpp b/src/engine/controls/loopingcontrol.cpp index fbce5c8a8d5a..7c67affbfc61 100644 --- a/src/engine/controls/loopingcontrol.cpp +++ b/src/engine/controls/loopingcontrol.cpp @@ -851,7 +851,6 @@ void LoopingControl::notifySeek(double dNewPlaypos) { setLoopingEnabled(false); } } - EngineControl::notifySeek(dNewPlaypos); } void LoopingControl::setLoopingEnabled(bool enabled) { diff --git a/src/engine/controls/quantizecontrol.cpp b/src/engine/controls/quantizecontrol.cpp index 0960edf22ac2..f343644cacbb 100644 --- a/src/engine/controls/quantizecontrol.cpp +++ b/src/engine/controls/quantizecontrol.cpp @@ -61,11 +61,6 @@ void QuantizeControl::setCurrentSample(const double dCurrentSample, playPosChanged(dCurrentSample); } -void QuantizeControl::notifySeek(double dNewPlaypos) { - EngineControl::notifySeek(dNewPlaypos); - playPosChanged(dNewPlaypos); -} - void QuantizeControl::playPosChanged(double dNewPlaypos) { // We only need to update the prev or next if the current sample is // out of range of the existing beat positions or if we've been forced to diff --git a/src/engine/controls/quantizecontrol.h b/src/engine/controls/quantizecontrol.h index ad59fbb18867..0ff770c84340 100644 --- a/src/engine/controls/quantizecontrol.h +++ b/src/engine/controls/quantizecontrol.h @@ -18,9 +18,10 @@ class QuantizeControl : public EngineControl { QuantizeControl(QString group, UserSettingsPointer pConfig); ~QuantizeControl() override; - void setCurrentSample(const double dCurrentSample, - const double dTotalSamples, const double dTrackSampleRate) override; - void notifySeek(double dNewPlaypos) override; + void setCurrentSample( + const double dCurrentSample, + const double dTotalSamples, + const double dTrackSampleRate) override; void trackLoaded(TrackPointer pNewTrack) override; void trackBeatsUpdated(mixxx::BeatsPointer pBeats) override; diff --git a/src/engine/controls/ratecontrol.cpp b/src/engine/controls/ratecontrol.cpp index e2b25a20f7eb..77b0a1feb3e0 100644 --- a/src/engine/controls/ratecontrol.cpp +++ b/src/engine/controls/ratecontrol.cpp @@ -591,11 +591,6 @@ void RateControl::resetRateTemp(void) setRateTemp(0.0); } -void RateControl::notifySeek(double playPos) { - m_pScratchController->notifySeek(playPos); - EngineControl::notifySeek(playPos); -} - bool RateControl::isReverseButtonPressed() { if (m_pReverseButton) { return m_pReverseButton->toBool(); diff --git a/src/engine/controls/ratecontrol.h b/src/engine/controls/ratecontrol.h index 731d16cb800d..44876996f913 100644 --- a/src/engine/controls/ratecontrol.h +++ b/src/engine/controls/ratecontrol.h @@ -80,7 +80,6 @@ class RateControl : public EngineControl { // Set Rate Ramp Sensitivity static void setRateRampSensitivity(int); static int getRateRampSensitivity(); - void notifySeek(double dNewPlaypos) override; bool isReverseButtonPressed(); public slots: diff --git a/src/engine/positionscratchcontroller.cpp b/src/engine/positionscratchcontroller.cpp index 44e8cd4d43ba..2b8135e2962b 100644 --- a/src/engine/positionscratchcontroller.cpp +++ b/src/engine/positionscratchcontroller.cpp @@ -273,9 +273,3 @@ bool PositionScratchController::isEnabled() { double PositionScratchController::getRate() { return m_dRate; } - -void PositionScratchController::notifySeek(double currentSample) { - // scratching continues after seek due to calculating the relative distance traveled - // in m_dPositionDeltaSum - m_dLastPlaypos = currentSample; -} diff --git a/src/engine/positionscratchcontroller.h b/src/engine/positionscratchcontroller.h index 55ab0d3eda50..c6fdf68f4bb6 100644 --- a/src/engine/positionscratchcontroller.h +++ b/src/engine/positionscratchcontroller.h @@ -18,7 +18,6 @@ class PositionScratchController : public QObject { int iBufferSize, double baserate); bool isEnabled(); double getRate(); - void notifySeek(double currentSample); private: const QString m_group; diff --git a/src/engine/sync/synccontrol.cpp b/src/engine/sync/synccontrol.cpp index 8c319fac8d82..683478c123db 100644 --- a/src/engine/sync/synccontrol.cpp +++ b/src/engine/sync/synccontrol.cpp @@ -476,13 +476,6 @@ void SyncControl::reportPlayerSpeed(double speed, bool scratching) { m_pEngineSync->notifyInstantaneousBpmChanged(this, instantaneous_bpm); } -void SyncControl::notifySeek(double dNewPlaypos) { - // qDebug() << "SyncControl::notifySeek" << dNewPlaypos; - EngineControl::notifySeek(dNewPlaypos); - m_pBpmControl->notifySeek(dNewPlaypos); - updateTargetBeatDistance(); -} - double SyncControl::fileBpm() const { mixxx::BeatsPointer pBeats = m_pBeats; if (pBeats) { diff --git a/src/engine/sync/synccontrol.h b/src/engine/sync/synccontrol.h index 3a0c3c24a639..5f236f5efd74 100644 --- a/src/engine/sync/synccontrol.h +++ b/src/engine/sync/synccontrol.h @@ -59,7 +59,6 @@ class SyncControl : public EngineControl, public Syncable { void reportTrackPosition(double fractionalPlaypos); void reportPlayerSpeed(double speed, bool scratching); - void notifySeek(double dNewPlaypos) override; void trackLoaded(TrackPointer pNewTrack) override; void trackBeatsUpdated(mixxx::BeatsPointer pBeats) override; diff --git a/src/test/readaheadmanager_test.cpp b/src/test/readaheadmanager_test.cpp index 2e29c1a84fdd..cb235c7173ad 100644 --- a/src/test/readaheadmanager_test.cpp +++ b/src/test/readaheadmanager_test.cpp @@ -57,19 +57,6 @@ class StubLoopControl : public LoopingControl { return m_triggerReturnValues.takeFirst(); } - // hintReader has no effect in this stubbed class - void hintReader(HintVector* pHintList) override { - Q_UNUSED(pHintList); - } - - void notifySeek(double dNewPlaypos) override { - Q_UNUSED(dNewPlaypos); - } - - void trackLoaded(TrackPointer pTrack) override { - Q_UNUSED(pTrack); - } - protected: QList m_triggerReturnValues; QList m_targetReturnValues;