From dfac9cb79485c6978cedaa294b8b11f9a5c5225a Mon Sep 17 00:00:00 2001 From: Craig Easton Date: Wed, 27 Jan 2016 00:06:35 +0000 Subject: BehringerCMDStudio4a mapping v1.4 Consolodated the pitch inc/dec functions. --- res/controllers/Behringer CMDStudio4a.midi.xml | 32 +++++------ res/controllers/Behringer-CMDStudio4a-scripts.js | 67 +++++++----------------- 2 files changed, 34 insertions(+), 65 deletions(-) diff --git a/res/controllers/Behringer CMDStudio4a.midi.xml b/res/controllers/Behringer CMDStudio4a.midi.xml index e0695364f0..ba51a19a80 100644 --- a/res/controllers/Behringer CMDStudio4a.midi.xml +++ b/res/controllers/Behringer CMDStudio4a.midi.xml @@ -828,7 +828,7 @@ [Channel1] - BehringerCMDStudio4a.pitchDec + BehringerCMDStudio4a.pitch Deck A pitch- push. 0x90 0x20 @@ -838,7 +838,7 @@ [Channel1] - BehringerCMDStudio4a.pitchDec + BehringerCMDStudio4a.pitch Deck A pitch- release. 0x80 0x20 @@ -848,7 +848,7 @@ [Channel1] - BehringerCMDStudio4a.pitchInc + BehringerCMDStudio4a.pitch Deck A pitch+ push. 0x90 0x21 @@ -858,7 +858,7 @@ [Channel1] - BehringerCMDStudio4a.pitchInc + BehringerCMDStudio4a.pitch Deck A pitch+ release. 0x80 0x21 @@ -868,7 +868,7 @@ [Channel2] - BehringerCMDStudio4a.pitchDec + BehringerCMDStudio4a.pitch Deck B pitch- push. 0x91 0x40 @@ -878,7 +878,7 @@ [Channel2] - BehringerCMDStudio4a.pitchDec + BehringerCMDStudio4a.pitch Deck B pitch- release. 0x81 0x40 @@ -888,7 +888,7 @@ [Channel2] - BehringerCMDStudio4a.pitchInc + BehringerCMDStudio4a.pitch Deck B pitch+ push. 0x91 0x41 @@ -898,7 +898,7 @@ [Channel2] - BehringerCMDStudio4a.pitchInc + BehringerCMDStudio4a.pitch Deck B pitch+ release. 0x81 0x41 @@ -908,7 +908,7 @@ [Channel3] - BehringerCMDStudio4a.pitchDec + BehringerCMDStudio4a.pitch Deck C pitch- push. 0x92 0x20 @@ -918,7 +918,7 @@ [Channel3] - BehringerCMDStudio4a.pitchDec + BehringerCMDStudio4a.pitch Deck C pitch- release. 0x82 0x20 @@ -928,7 +928,7 @@ [Channel3] - BehringerCMDStudio4a.pitchInc + BehringerCMDStudio4a.pitch Deck C pitch+ push. 0x92 0x21 @@ -938,7 +938,7 @@ [Channel3] - BehringerCMDStudio4a.pitchInc + BehringerCMDStudio4a.pitch Deck C pitch+ release. 0x82 0x21 @@ -948,7 +948,7 @@ [Channel4] - BehringerCMDStudio4a.pitchDec + BehringerCMDStudio4a.pitch Deck D pitch- push. 0x93 0x40 @@ -958,7 +958,7 @@ [Channel4] - BehringerCMDStudio4a.pitchDec + BehringerCMDStudio4a.pitch Deck D pitch- release. 0x83 0x40 @@ -968,7 +968,7 @@ [Channel4] - BehringerCMDStudio4a.pitchInc + BehringerCMDStudio4a.pitch Deck D pitch+ push. 0x93 0x41 @@ -978,7 +978,7 @@ [Channel4] - BehringerCMDStudio4a.pitchInc + BehringerCMDStudio4a.pitch Deck D pitch+ release. 0x83 0x41 diff --git a/res/controllers/Behringer-CMDStudio4a-scripts.js b/res/controllers/Behringer-CMDStudio4a-scripts.js index 240bcef2f5..da0b468fe4 100644 --- a/res/controllers/Behringer-CMDStudio4a-scripts.js +++ b/res/controllers/Behringer-CMDStudio4a-scripts.js @@ -26,8 +26,7 @@ BehringerCMDStudio4a.delButtonState = [false,false,false,false]; BehringerCMDStudio4a.scratchButtonState = [false,false,false,false]; // Button push/release state variables. -BehringerCMDStudio4a.pitchDecPushed = [false,false,false,false]; -BehringerCMDStudio4a.pitchIncPushed = [false,false,false,false]; +BehringerCMDStudio4a.pitchPushed = [[false,false,false,false], [false,false,false,false]]; BehringerCMDStudio4a.delPushed = false; BehringerCMDStudio4a.delShiftUsed = false; BehringerCMDStudio4a.fxAssignPushed = false; @@ -208,7 +207,7 @@ BehringerCMDStudio4a.hotcue = function (channel, control, value, status, group) // turn it on directly here, the only work-around I could // think of was to create a (very short) timed call-back // to turn it off! - // Raised bug about this. + // Raised bug about this: // https://bugs.launchpad.net/mixxx/+bug/1538200 // Changed timer from 50 to 100 after the pathology of this // bug was explined in the bug report. @@ -223,56 +222,26 @@ BehringerCMDStudio4a.hotcue = function (channel, control, value, status, group) } // Functions to deal with the pitch inc/dec buttons, (because they have a DEL-mode behaviour). -BehringerCMDStudio4a.pitchDec = function (channel, control, value, status, group) { +BehringerCMDStudio4a.pitch = function (channel, control, value, status, group) { + // Work out the direction. + var direction = ((control & 0x01) == 0) ? "down" : "up"; + // Work out the type (and join) by looking at the DEL button state. + var type = BehringerCMDStudio4a.delButtonState[channel] ? "pitch" : "rate"; + var join = BehringerCMDStudio4a.delButtonState[channel] ? "" : "_perm"; + // Pushed or released? if (value == 127) { // Button pushed. - BehringerCMDStudio4a.pitchDecPushed[channel] = true; - if (BehringerCMDStudio4a.delButtonState[channel]) { - // DEL mode is active, do "key" changes instead. - // Check if the other button is pressed too, if so we reset the pitch. - if (BehringerCMDStudio4a.pitchIncPushed[channel]) { - engine.setValue(group, "pitch", 0); - } else { - engine.setValue(group, "pitch_down", 1); - } - } else { - // DEL-mode is not active, just do "rate" changes. - engine.setValue(group, "rate_perm_down", 1); - // Check if the other button is pressed too, if so we reset the rate. - if (BehringerCMDStudio4a.pitchIncPushed[channel]) { - engine.setValue(group, "rate", 0); - } - } - } else { - // Button released. - BehringerCMDStudio4a.pitchDecPushed[channel] = false; - engine.setValue(group, "rate_perm_down", 0); // Keeps the UI in sync with the button state. - } -} -BehringerCMDStudio4a.pitchInc = function (channel, control, value, status, group) { - if (value == 127) { - // Button pushed. - BehringerCMDStudio4a.pitchIncPushed[channel] = true; - if (BehringerCMDStudio4a.delButtonState[channel]) { - // DEL-mode is active, do "key" changes instead. - // Check if the other button is pressed too, if so we reset the pitch. - if (BehringerCMDStudio4a.pitchDecPushed[channel]) { - engine.setValue(group, "pitch", 0); - } else { - engine.setValue(group, "pitch_up", 1); - } - } else { - // DEL-mode is not active, just do "rate" changes. - engine.setValue(group, "rate_perm_up", 1); - // Check if the other button is pressed too, if so we reset the rate. - if (BehringerCMDStudio4a.pitchDecPushed[channel]) { - engine.setValue(group, "rate", 0); - } - } + BehringerCMDStudio4a.pitchPushed[control & 0x01][channel] = true; + // Is the other button pushed too? + if (BehringerCMDStudio4a.pitchPushed[(~control) & 0x01][channel]) { + engine.setValue(group, type, 0); // Yep! reset the control. + } else { + engine.setValue(group, type+join+"_"+direction, 1); + } } else { // Button released. - BehringerCMDStudio4a.pitchIncPushed[channel] = false; - engine.setValue(group, "rate_perm_up", 0); // Keeps the UI in sync with the button state. + BehringerCMDStudio4a.pitchPushed[control & 0x01][channel] = false; + engine.setValue(group, "rate_perm_"+direction, 0); // Keeps the UI in sync with the button state. } } -- cgit v1.2.3