Skip to content

Commit

Permalink
use controlproxylt
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Jan 1, 2019
1 parent da367e1 commit 368e5fc
Show file tree
Hide file tree
Showing 62 changed files with 1,074 additions and 1,201 deletions.
3 changes: 1 addition & 2 deletions src/control/controlmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ void ControlModel::addControl(const ConfigKey& key,
info.key = key;
info.title = title;
info.description = description;
info.pControl = new ControlProxy(this);
info.pControl->initialize(info.key);
info.pControl = new ControlProxy(info.key, this);

beginInsertRows(QModelIndex(), m_controls.size(),
m_controls.size());
Expand Down
4 changes: 1 addition & 3 deletions src/control/controlproxy.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
#include <QtDebug>

#include "control/controlproxy.h"
#include "control/control.h"

namespace {
const ConfigKey kNullKey; // because we return it as a reference
}

ControlProxy::ControlProxy(QObject* pParent)
: QObject(pParent),
m_pControl(NULL) {
: QObject(pParent) {
}

ControlProxy::ControlProxy(const QString& g, const QString& i, QObject* pParent)
Expand Down
8 changes: 4 additions & 4 deletions src/control/controlproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
class ControlProxy : public QObject {
Q_OBJECT
public:
ControlProxy(QObject* pParent = NULL);
ControlProxy(const QString& g, const QString& i, QObject* pParent = NULL);
ControlProxy(const char* g, const char* i, QObject* pParent = NULL);
ControlProxy(const ConfigKey& key, QObject* pParent = NULL);
ControlProxy(QObject* pParent = nullptr);
ControlProxy(const QString& g, const QString& i, QObject* pParent);
ControlProxy(const char* g, const char* i, QObject* pParent);
ControlProxy(const ConfigKey& key, QObject* pParent);
virtual ~ControlProxy();

void initialize(const ConfigKey& key, bool warn = true);
Expand Down
10 changes: 4 additions & 6 deletions src/effects/builtin/bessel4lvmixeqeffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ Bessel4LVMixEQEffect::Bessel4LVMixEQEffect(EngineEffect* pEffect)
m_pPotHigh(pEffect->getParameterById("high")),
m_pKillLow(pEffect->getParameterById("killLow")),
m_pKillMid(pEffect->getParameterById("killMid")),
m_pKillHigh(pEffect->getParameterById("killHigh")) {
m_pLoFreqCorner = new ControlProxy("[Mixer Profile]", "LoEQFrequency");
m_pHiFreqCorner = new ControlProxy("[Mixer Profile]", "HiEQFrequency");
m_pKillHigh(pEffect->getParameterById("killHigh")),
m_loFreqCorner("[Mixer Profile]", "LoEQFrequency"),
m_hiFreqCorner("[Mixer Profile]", "HiEQFrequency") {
}

Bessel4LVMixEQEffect::~Bessel4LVMixEQEffect() {
delete m_pLoFreqCorner;
delete m_pHiFreqCorner;
}

void Bessel4LVMixEQEffect::processChannel(const ChannelHandle& handle,
Expand Down Expand Up @@ -76,6 +74,6 @@ void Bessel4LVMixEQEffect::processChannel(const ChannelHandle& handle,
bufferParameters.samplesPerBuffer(),
bufferParameters.sampleRate(),
fLow, fMid, fHigh,
m_pLoFreqCorner->get(), m_pHiFreqCorner->get());
m_loFreqCorner.get(), m_hiFreqCorner.get());
}
}
6 changes: 3 additions & 3 deletions src/effects/builtin/bessel4lvmixeqeffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <QMap>

#include "control/controlproxy.h"
#include "control/controlproxylt.h"
#include "effects/effect.h"
#include "effects/effectprocessor.h"
#include "effects/builtin/lvmixeqbase.h"
Expand Down Expand Up @@ -52,8 +52,8 @@ class Bessel4LVMixEQEffect : public EffectProcessorImpl<Bessel4LVMixEQEffectGrou
EngineEffectParameter* m_pKillMid;
EngineEffectParameter* m_pKillHigh;

ControlProxy* m_pLoFreqCorner;
ControlProxy* m_pHiFreqCorner;
ControlProxyLt m_loFreqCorner;
ControlProxyLt m_hiFreqCorner;

DISALLOW_COPY_AND_ASSIGN(Bessel4LVMixEQEffect);
};
Expand Down
10 changes: 4 additions & 6 deletions src/effects/builtin/bessel8lvmixeqeffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ Bessel8LVMixEQEffect::Bessel8LVMixEQEffect(EngineEffect* pEffect)
m_pPotHigh(pEffect->getParameterById("high")),
m_pKillLow(pEffect->getParameterById("killLow")),
m_pKillMid(pEffect->getParameterById("killMid")),
m_pKillHigh(pEffect->getParameterById("killHigh")) {
m_pLoFreqCorner = new ControlProxy("[Mixer Profile]", "LoEQFrequency");
m_pHiFreqCorner = new ControlProxy("[Mixer Profile]", "HiEQFrequency");
m_pKillHigh(pEffect->getParameterById("killHigh")),
m_loFreqCorner("[Mixer Profile]", "LoEQFrequency"),
m_hiFreqCorner("[Mixer Profile]", "HiEQFrequency") {
}

Bessel8LVMixEQEffect::~Bessel8LVMixEQEffect() {
delete m_pLoFreqCorner;
delete m_pHiFreqCorner;
}

void Bessel8LVMixEQEffect::processChannel(const ChannelHandle& handle,
Expand Down Expand Up @@ -76,6 +74,6 @@ void Bessel8LVMixEQEffect::processChannel(const ChannelHandle& handle,
pInput, pOutput,
bufferParameters.samplesPerBuffer(), bufferParameters.sampleRate(),
fLow, fMid, fHigh,
m_pLoFreqCorner->get(), m_pHiFreqCorner->get());
m_loFreqCorner.get(), m_hiFreqCorner.get());
}
}
6 changes: 3 additions & 3 deletions src/effects/builtin/bessel8lvmixeqeffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <QMap>

#include "control/controlproxy.h"
#include "control/controlproxylt.h"
#include "effects/effect.h"
#include "effects/effectprocessor.h"
#include "engine/effects/engineeffect.h"
Expand Down Expand Up @@ -55,8 +55,8 @@ class Bessel8LVMixEQEffect : public EffectProcessorImpl<Bessel8LVMixEQEffectGrou
EngineEffectParameter* m_pKillMid;
EngineEffectParameter* m_pKillHigh;

ControlProxy* m_pLoFreqCorner;
ControlProxy* m_pHiFreqCorner;
ControlProxyLt m_loFreqCorner;
ControlProxyLt m_hiFreqCorner;

DISALLOW_COPY_AND_ASSIGN(Bessel8LVMixEQEffect);
};
Expand Down
16 changes: 8 additions & 8 deletions src/effects/builtin/biquadfullkilleqeffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ BiquadFullKillEQEffect::BiquadFullKillEQEffect(EngineEffect* pEffect)
m_pPotHigh(pEffect->getParameterById("high")),
m_pKillLow(pEffect->getParameterById("killLow")),
m_pKillMid(pEffect->getParameterById("killMid")),
m_pKillHigh(pEffect->getParameterById("killHigh")) {
m_pLoFreqCorner = std::make_unique<ControlProxy>("[Mixer Profile]", "LoEQFrequency");
m_pHiFreqCorner = std::make_unique<ControlProxy>("[Mixer Profile]", "HiEQFrequency");
m_pKillHigh(pEffect->getParameterById("killHigh")),
m_loFreqCorner("[Mixer Profile]", "LoEQFrequency"),
m_hiFreqCorner("[Mixer Profile]", "HiEQFrequency") {
}

// BiquadFullKillEQEffect::~BiquadFullKillEQEffect() {
Expand All @@ -161,10 +161,10 @@ void BiquadFullKillEQEffect::processChannel(
Q_UNUSED(groupFeatures);

if (pState->m_oldSampleRate != bufferParameters.sampleRate() ||
(pState->m_loFreqCorner != m_pLoFreqCorner->get()) ||
(pState->m_highFreqCorner != m_pHiFreqCorner->get())) {
pState->m_loFreqCorner = m_pLoFreqCorner->get();
pState->m_highFreqCorner = m_pHiFreqCorner->get();
(pState->m_loFreqCorner != m_loFreqCorner.get()) ||
(pState->m_highFreqCorner != m_hiFreqCorner.get())) {
pState->m_loFreqCorner = m_loFreqCorner.get();
pState->m_highFreqCorner = m_hiFreqCorner.get();
pState->m_oldSampleRate = bufferParameters.sampleRate();
pState->setFilters(bufferParameters.sampleRate(),
pState->m_loFreqCorner, pState->m_highFreqCorner);
Expand Down Expand Up @@ -397,6 +397,6 @@ void BiquadFullKillEQEffect::processChannel(
pOutput, pOutput,
bufferParameters.samplesPerBuffer(), bufferParameters.sampleRate(),
fLow, fMid, fHigh,
m_pLoFreqCorner->get(), m_pHiFreqCorner->get());
m_loFreqCorner.get(), m_hiFreqCorner.get());
}
}
6 changes: 3 additions & 3 deletions src/effects/builtin/biquadfullkilleqeffect.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef BIQUADFULLKILLEQEFFECT_H
#define BIQUADFULLKILLEQEFFECT_H

#include "control/controlproxy.h"
#include "control/controlproxylt.h"
#include "effects/effect.h"
#include "effects/effectprocessor.h"
#include "engine/effects/engineeffect.h"
Expand Down Expand Up @@ -90,8 +90,8 @@ class BiquadFullKillEQEffect : public EffectProcessorImpl<BiquadFullKillEQEffect
EngineEffectParameter* m_pKillMid;
EngineEffectParameter* m_pKillHigh;

std::unique_ptr<ControlProxy> m_pLoFreqCorner;
std::unique_ptr<ControlProxy> m_pHiFreqCorner;
ControlProxyLt m_loFreqCorner;
ControlProxyLt m_hiFreqCorner;
};

#endif // BIQUADFULLKILLEQEFFECT_H
16 changes: 7 additions & 9 deletions src/effects/builtin/linkwitzriley8eqeffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,12 @@ LinkwitzRiley8EQEffect::LinkwitzRiley8EQEffect(EngineEffect* pEffect)
m_pPotHigh(pEffect->getParameterById("high")),
m_pKillLow(pEffect->getParameterById("killLow")),
m_pKillMid(pEffect->getParameterById("killMid")),
m_pKillHigh(pEffect->getParameterById("killHigh")) {
m_pLoFreqCorner = new ControlProxy("[Mixer Profile]", "LoEQFrequency");
m_pHiFreqCorner = new ControlProxy("[Mixer Profile]", "HiEQFrequency");
m_pKillHigh(pEffect->getParameterById("killHigh")),
m_loFreqCorner("[Mixer Profile]", "LoEQFrequency"),
m_hiFreqCorner("[Mixer Profile]", "HiEQFrequency") {
}

LinkwitzRiley8EQEffect::~LinkwitzRiley8EQEffect() {
delete m_pLoFreqCorner;
delete m_pHiFreqCorner;
}

void LinkwitzRiley8EQEffect::processChannel(const ChannelHandle& handle,
Expand All @@ -103,10 +101,10 @@ void LinkwitzRiley8EQEffect::processChannel(const ChannelHandle& handle,
}

if (pState->m_oldSampleRate != bufferParameters.sampleRate() ||
(pState->m_loFreq != static_cast<int>(m_pLoFreqCorner->get())) ||
(pState->m_hiFreq != static_cast<int>(m_pHiFreqCorner->get()))) {
pState->m_loFreq = static_cast<int>(m_pLoFreqCorner->get());
pState->m_hiFreq = static_cast<int>(m_pHiFreqCorner->get());
(pState->m_loFreq != static_cast<int>(m_loFreqCorner.get())) ||
(pState->m_hiFreq != static_cast<int>(m_hiFreqCorner.get()))) {
pState->m_loFreq = static_cast<int>(m_loFreqCorner.get());
pState->m_hiFreq = static_cast<int>(m_hiFreqCorner.get());
pState->m_oldSampleRate = bufferParameters.sampleRate();
pState->setFilters(bufferParameters.sampleRate(), pState->m_loFreq, pState->m_hiFreq);
}
Expand Down
6 changes: 3 additions & 3 deletions src/effects/builtin/linkwitzriley8eqeffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <QMap>

#include "control/controlproxy.h"
#include "control/controlproxylt.h"
#include "effects/effect.h"
#include "effects/effectprocessor.h"
#include "engine/effects/engineeffect.h"
Expand Down Expand Up @@ -68,8 +68,8 @@ class LinkwitzRiley8EQEffect : public EffectProcessorImpl<LinkwitzRiley8EQEffect
EngineEffectParameter* m_pKillMid;
EngineEffectParameter* m_pKillHigh;

ControlProxy* m_pLoFreqCorner;
ControlProxy* m_pHiFreqCorner;
ControlProxyLt m_loFreqCorner;
ControlProxyLt m_hiFreqCorner;

DISALLOW_COPY_AND_ASSIGN(LinkwitzRiley8EQEffect);
};
Expand Down
17 changes: 9 additions & 8 deletions src/effects/builtin/threebandbiquadeqeffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ ThreeBandBiquadEQEffect::ThreeBandBiquadEQEffect(EngineEffect* pEffect)
m_pPotHigh(pEffect->getParameterById("high")),
m_pKillLow(pEffect->getParameterById("killLow")),
m_pKillMid(pEffect->getParameterById("killMid")),
m_pKillHigh(pEffect->getParameterById("killHigh")) {
m_pLoFreqCorner = std::make_unique<ControlProxy>("[Mixer Profile]", "LoEQFrequency");
m_pHiFreqCorner = std::make_unique<ControlProxy>("[Mixer Profile]", "HiEQFrequency");
m_pKillHigh(pEffect->getParameterById("killHigh")),
m_loFreqCorner("[Mixer Profile]", "LoEQFrequency"),
m_hiFreqCorner("[Mixer Profile]", "HiEQFrequency") {
}

ThreeBandBiquadEQEffect::~ThreeBandBiquadEQEffect() {
Expand All @@ -150,12 +150,13 @@ void ThreeBandBiquadEQEffect::processChannel(
Q_UNUSED(groupFeatures);

if (pState->m_oldSampleRate != bufferParameters.sampleRate() ||
(pState->m_loFreqCorner != m_pLoFreqCorner->get()) ||
(pState->m_highFreqCorner != m_pHiFreqCorner->get())) {
pState->m_loFreqCorner = m_pLoFreqCorner->get();
pState->m_highFreqCorner = m_pHiFreqCorner->get();
(pState->m_loFreqCorner != m_loFreqCorner.get()) ||
(pState->m_highFreqCorner != m_hiFreqCorner.get())) {
pState->m_loFreqCorner = m_loFreqCorner.get();
pState->m_highFreqCorner = m_hiFreqCorner.get();
pState->m_oldSampleRate = bufferParameters.sampleRate();
pState->setFilters(bufferParameters.sampleRate(), pState->m_loFreqCorner, pState->m_highFreqCorner);
pState->setFilters(bufferParameters.sampleRate(),
pState->m_loFreqCorner, pState->m_highFreqCorner);
}


Expand Down
6 changes: 3 additions & 3 deletions src/effects/builtin/threebandbiquadeqeffect.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef THREEBANDBIQUADEQEFFECT_H
#define THREEBANDBIQUADEQEFFECT_H

#include "control/controlproxy.h"
#include "control/controlproxylt.h"
#include "effects/effect.h"
#include "effects/effectprocessor.h"
#include "engine/effects/engineeffect.h"
Expand Down Expand Up @@ -76,8 +76,8 @@ class ThreeBandBiquadEQEffect : public EffectProcessorImpl<ThreeBandBiquadEQEffe
EngineEffectParameter* m_pKillMid;
EngineEffectParameter* m_pKillHigh;

std::unique_ptr<ControlProxy> m_pLoFreqCorner;
std::unique_ptr<ControlProxy> m_pHiFreqCorner;
ControlProxyLt m_loFreqCorner;
ControlProxyLt m_hiFreqCorner;
};

#endif // THREEBANDBIQUADEQEFFECT_H
21 changes: 10 additions & 11 deletions src/engine/bpmcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ BpmControl::BpmControl(QString group,
UserSettingsPointer pConfig)
: EngineControl(group, pConfig),
m_tapFilter(this, kFilterLength, kMaxInterval),
m_nextBeat(group, "beat_next"),
m_prevBeat(group, "beat_prev"),
m_closestBeat(group, "beat_closest")
m_dSyncInstantaneousBpm(0.0),
m_dLastSyncAdjustment(1.0),
m_sGroup(group) {
Expand All @@ -48,10 +51,6 @@ BpmControl::BpmControl(QString group,
m_pRateDir->connectValueChanged(SLOT(slotUpdateEngineBpm()),
Qt::DirectConnection);

m_pPrevBeat.reset(new ControlProxy(group, "beat_prev"));
m_pNextBeat.reset(new ControlProxy(group, "beat_next"));
m_pClosestBeat.reset(new ControlProxy(group, "beat_closest"));

m_pLoopEnabled = new ControlProxy(group, "loop_enabled", this);
m_pLoopStartPosition = new ControlProxy(group, "loop_start_position", this);
m_pLoopEndPosition = new ControlProxy(group, "loop_end_position", this);
Expand Down Expand Up @@ -405,7 +404,7 @@ double BpmControl::calcSyncedRate(double userTweak) {
double dBeatLength;
double my_percentage;
if (!BpmControl::getBeatContextNoLookup(dThisPosition,
m_pPrevBeat->get(), m_pNextBeat->get(),
m_prevBeat.get(), m_nextBeat.get(),
&dBeatLength, &my_percentage)) {
m_resetSyncAdjustment = true;
return rate + userTweak;
Expand Down Expand Up @@ -505,8 +504,8 @@ double BpmControl::getBeatDistance(double dThisPosition) const {
// is used in synccontrol to update the internal clock beat distance, and if
// we don't adjust the reported distance the track will try to adjust
// sync against itself.
double dPrevBeat = m_pPrevBeat->get();
double dNextBeat = m_pNextBeat->get();
double dPrevBeat = m_prevBeat.get();
double dNextBeat = m_nextBeat.get();

if (dPrevBeat == -1 || dNextBeat == -1) {
return 0.0 - m_dUserOffset.getValue();
Expand Down Expand Up @@ -593,8 +592,8 @@ double BpmControl::getNearestPositionInPhase(
}

// Get the current position of this deck.
double dThisPrevBeat = m_pPrevBeat->get();
double dThisNextBeat = m_pNextBeat->get();
double dThisPrevBeat = m_prevBeat.get();
double dThisNextBeat = m_nextBeat.get();
double dThisBeatLength;
if (dThisPosition > dThisNextBeat || dThisPosition < dThisPrevBeat) {
// There's a chance the COs might be out of date, so do a lookup.
Expand Down Expand Up @@ -858,8 +857,8 @@ void BpmControl::collectFeatures(GroupFeatureState* pGroupFeatures) const {
}

// Get the current position of this deck.
double dThisPrevBeat = m_pPrevBeat->get();
double dThisNextBeat = m_pNextBeat->get();
double dThisPrevBeat = m_prevBeat.get();
double dThisNextBeat = m_nextBeat.get();
double dThisBeatLength;
double dThisBeatFraction;
if (getBeatContextNoLookup(sot.current,
Expand Down
7 changes: 4 additions & 3 deletions src/engine/bpmcontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <gtest/gtest_prod.h>

#include "control/controlobject.h"
#include "control/controlproxylt.h"
#include "engine/enginecontrol.h"
#include "engine/sync/syncable.h"
#include "util/tapfilter.h"
Expand Down Expand Up @@ -109,9 +110,9 @@ class BpmControl : public EngineControl {
ControlProxy* m_pRateDir;

// ControlObjects that come from QuantizeControl
QScopedPointer<ControlProxy> m_pNextBeat;
QScopedPointer<ControlProxy> m_pPrevBeat;
QScopedPointer<ControlProxy> m_pClosestBeat;
ControlProxyLt m_nextBeat;
ControlProxyLt m_prevBeat;
ControlProxyLt m_closestBeat;

// ControlObjects that come from LoopingControl
ControlProxy* m_pLoopEnabled;
Expand Down
Loading

0 comments on commit 368e5fc

Please sign in to comment.