From 2a7772e6ee4d4c1274c6e3bdaabb356a0e74dfaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20Le=20Doar=C3=A9?= Date: Tue, 2 May 2023 09:20:32 +0000 Subject: [PATCH] Add Behringer-CMD-PL-1 controller --- res/controllers/Behringer CMD PL-1.midi.xml | 75 +++++++++++++++++++ res/controllers/Behringer-CMD-PL-1-scripts.js | 48 ++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 res/controllers/Behringer CMD PL-1.midi.xml create mode 100644 res/controllers/Behringer-CMD-PL-1-scripts.js diff --git a/res/controllers/Behringer CMD PL-1.midi.xml b/res/controllers/Behringer CMD PL-1.midi.xml new file mode 100644 index 00000000000..215e6da5ffc --- /dev/null +++ b/res/controllers/Behringer CMD PL-1.midi.xml @@ -0,0 +1,75 @@ + + + + Behringer CMD PL-1 + Yann Le Doaré + Mapping for the Behringer CMD PL-1 single-deck controller + https://mixxx.discourse.group/t/behringer-cmd-pl-1/15755/2 + https://github.com/mixxxdj/mixxx/wiki/Behringer%20CMD%20PL-1 + + + + + + + + [Channel1] + play i + Play i + 0x90 i + 0x23 + + + + [Channel2] + play + Play + 0x91 + 0x23 + + + + [Channel1] + cue_default + Cue + 0x90 + 0x22 + + + [Channel2] + cue_default + Cue + 0x91 + 0x22 + + + + [Channel1] + CMDPL1.wheelTurn + 0xB0 + 0x1F + + + + [Channel2] + CMDPL1.wheelTurn + 0xB1 + 0x1F + + + + [Channel1] + CMDPL1.pitchSlider + 0xE0 + + + + [Channel2] + CMDPL1.pitchSlider + 0xE1 + + + + + + diff --git a/res/controllers/Behringer-CMD-PL-1-scripts.js b/res/controllers/Behringer-CMD-PL-1-scripts.js new file mode 100644 index 00000000000..6c56a24a900 --- /dev/null +++ b/res/controllers/Behringer-CMD-PL-1-scripts.js @@ -0,0 +1,48 @@ +var CMDPL1 = {}; + +CMDPL1.init = function() { + // mixxx --controllerDebug + //print("> Init CMDPL1 Done"); +}; + +CMDPL1.pitchSlider = function(channel, control, value, status, group) { // Lower the sensitivity of the pitch slider + const currentValue = engine.getValue(group, "rate"); + //print("> Current : "+currentValue); + //print("> value : "+value); + engine.setValue(group, "rate", (value-64)/64); +}; + +CMDPL1.wheel = function(channel, control, value, status, group) { // Lower the sensitivity of the pitch slider + const currentValue = engine.getValue(group, "rate"); + //print("> Current : "+currentValue); + //print("> value : "+value); + engine.setValue(group, "rate", currentValue+(value-64)/128); + // engine.setValue(group,"rate",(value-64)/64); +}; + +// The wheel that actually controls the scratching +CMDPL1.wheelTurn = function(channel, control, value, status, group) { + let deckNumber = script.deckFromGroup(group); + //print("> value : "+deckNumber); + + // A: For a control that centers on 0: + let newValue; + if (value < 64) { + newValue = value; + } else { + newValue = value - 128; + } + + // B: For a control that centers on 0x40 (64): + newValue = value - 64; + + // --- End choice + + // In either case, register the movement + deckNumber = script.deckFromGroup(group); + if (engine.isScratching(deckNumber)) { + engine.scratchTick(deckNumber, newValue); // Scratch! + } else { + engine.setValue(group, "jog", newValue); // Pitch bend + } +};