diff options
author | Sean M. Pappalardo <pegasus@renegadetech.com> | 2015-11-30 00:24:05 -0800 |
---|---|---|
committer | Sean M. Pappalardo <pegasus@renegadetech.com> | 2015-12-11 07:38:16 -0800 |
commit | e4024b4c2a01e65e3bf2f1d386f5bc71f9d96b6f (patch) | |
tree | 30ed29e50a7787fbdcb2d1ab0fdfc79d70ee81a5 | |
parent | 27855556b0090bba61c412c8cdd2f29b50f18b24 (diff) |
Cherry-picked commit from st_fix to fix my mess
-rw-r--r-- | res/controllers/American-Audio-VMS4-scripts.js | 41 | ||||
-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 |
5 files changed, 61 insertions, 18 deletions
diff --git a/res/controllers/American-Audio-VMS4-scripts.js b/res/controllers/American-Audio-VMS4-scripts.js index bcda9e2583..bdc316c998 100644 --- a/res/controllers/American-Audio-VMS4-scripts.js +++ b/res/controllers/American-Audio-VMS4-scripts.js @@ -228,16 +228,18 @@ VMS4.Deck.prototype.keyLockButtonHandler = function(value) { } VMS4.Deck.prototype.effectParamButtonHandler = function(value) { - // Reset pitch only on entrance to center position - if(value == ButtonState.pressed) { - this.controlEffectParameter=!this.controlEffectParameter; - if (this.controlEffectParameter) { - this.Buttons.FXParam.setLed(LedState.on); - } - else { - this.Buttons.FXParam.setLed(LedState.off); - } - } +// // Reset pitch only on entrance to center position +// if(value == ButtonState.pressed) { +// this.controlEffectParameter=!this.controlEffectParameter; +// if (this.controlEffectParameter) { +// // Super knob +// this.Buttons.FXParam.setLed(LedState.on); +// } +// else { +// // Wet/dry +// this.Buttons.FXParam.setLed(LedState.off); +// } +// } } VMS4.Decks = {"Left":new VMS4.Deck(1,"[Channel1]"), "Right":new VMS4.Deck(2,"[Channel2]")}; @@ -339,7 +341,24 @@ VMS4.effectControl = function(channel, control, value, status, group) { VMS4.effectParameterButton = function(channel, control, value, status, group) { var deck = VMS4.GetDeck(group); - deck.Buttons.FXParam.handleEvent(value); +// deck.Buttons.FXParam.handleEvent(group, value); + // Reset pitch only on entrance to center position + if(value > 0x40) { + var deckNum = VMS4.GetDeckNum(group); + deck.controlEffectParameter=!deck.controlEffectParameter; + if (deck.controlEffectParameter) { + // Super knob + deck.Buttons.FXParam.setLed(LedState.on); + // Ignore the next wet/dry value + engine.softTakeoverIgnoreNext("[EffectRack1_EffectUnit"+deckNum+"]","mix"); + } + else { + // Wet/dry + deck.Buttons.FXParam.setLed(LedState.off); + // Ignore the next Super knob value + engine.softTakeoverIgnoreNext("[EffectRack1_EffectUnit"+deckNum+"]","super1"); + } + } } 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; |