diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/controllers/controllerengine.cpp | 16 | ||||
-rw-r--r-- | src/controllers/controllerengine.h | 1 | ||||
-rw-r--r-- | src/controllers/softtakeover.cpp | 11 | ||||
-rw-r--r-- | src/controllers/softtakeover.h | 10 |
4 files changed, 31 insertions, 7 deletions
diff --git a/src/controllers/controllerengine.cpp b/src/controllers/controllerengine.cpp index 63d54c2e58..7e25c7a28f 100644 --- a/src/controllers/controllerengine.cpp +++ b/src/controllers/controllerengine.cpp @@ -1440,6 +1440,22 @@ void ControllerEngine::softTakeover(QString group, QString name, bool set) { } /* -------- ------------------------------------------------------ + Purpose: Ignores the next value for the given ControlObject + This is used when an absolute physical control is changed to + to operate on a different ControlObject + Input: ControlObject group and key values + Output: - + -------- ------------------------------------------------------ */ +void ControllerEngine::softTakeoverIgnoreNext(QString group, QString name) { + ControlObject* pControl = ControlObject::getControl(ConfigKey(group, name)); + if (!pControl) { + return; + } + + m_st.ignoreNext(pControl); +} + +/* -------- ------------------------------------------------------ Purpose: [En/dis]ables spinback effect for the channel Input: deck, activate/deactivate, factor (optional), delay (optional), rate (optional) diff --git a/src/controllers/controllerengine.h b/src/controllers/controllerengine.h index 7c1be4b1d2..8c4ca6886d 100644 --- a/src/controllers/controllerengine.h +++ b/src/controllers/controllerengine.h @@ -107,6 +107,7 @@ class ControllerEngine : public QObject { Q_INVOKABLE void scratchDisable(int deck, bool ramp = true); Q_INVOKABLE bool isScratching(int deck); Q_INVOKABLE void softTakeover(QString group, QString name, bool set); + Q_INVOKABLE void softTakeoverIgnoreNext(QString group, QString name); Q_INVOKABLE void brake(int deck, bool activate, double factor=0.9, double rate=1.0); Q_INVOKABLE void spinback(int deck, bool activate, double factor=1.8, double rate=-10.0); diff --git a/src/controllers/softtakeover.cpp b/src/controllers/softtakeover.cpp index af7e08a005..ad3b4e73ea 100644 --- a/src/controllers/softtakeover.cpp +++ b/src/controllers/softtakeover.cpp @@ -60,14 +60,21 @@ bool SoftTakeoverCtrl::ignore(ControlObject* control, double newParameter) { return ignore; } +void SoftTakeoverCtrl::ignoreNext(ControlObject* control) { + if (control != NULL) { + SoftTakeover* pSt = m_softTakeoverHash.value(control); + if (pSt) { + pSt->ignoreNext(); + } + } +} + SoftTakeover::SoftTakeover() : m_time(0), m_prevParameter(0), m_dThreshold(kDefaultTakeoverThreshold) { } -const double SoftTakeover::kDefaultTakeoverThreshold = 3.0 / 128; - void SoftTakeover::setThreshold(double threshold) { m_dThreshold = threshold; } diff --git a/src/controllers/softtakeover.h b/src/controllers/softtakeover.h index f432517809..db5bdbb34a 100644 --- a/src/controllers/softtakeover.h +++ b/src/controllers/softtakeover.h @@ -13,13 +13,11 @@ class ControlObject; -// 3/128 units away from the current is enough to catch fast non-sequential moves -// but not cause an audibly noticeable jump. - - class SoftTakeover { public: - static const double kDefaultTakeoverThreshold; + // 3/128 units away from the current is enough to catch fast non-sequential moves + // but not cause an audibly noticeable jump. + static const double kDefaultTakeoverThreshold = 3.0 / 128; SoftTakeover(); bool ignore(ControlObject* control, double newParameter); @@ -58,6 +56,8 @@ class SoftTakeoverCtrl { void disable(ControlObject* control); // Check to see if the new value for the Control should be ignored bool ignore(ControlObject* control, double newMidiParameter); + // Ignore the next supplied parameter + void ignoreNext(ControlObject* control); private: QHash<ControlObject*, SoftTakeover*> m_softTakeoverHash; |