Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Behringer-CMD-PL-1 controller #11529

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions res/controllers/Behringer CMD PL-1.midi.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version='1.0' encoding='utf-8'?>
<MixxxControllerPreset mixxxVersion="2.3.0+" schemaVersion="1">
<info>
<name>Behringer CMD PL-1</name>
<author>Yann Le Doaré</author>
<description>Mapping for the Behringer CMD PL-1 single-deck controller</description>
<forums>https://mixxx.discourse.group/t/behringer-cmd-pl-1/15755/2</forums>
<wiki>https://github.com/mixxxdj/mixxx/wiki/Behringer%20CMD%20PL-1</wiki>
Comment on lines +7 to +8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The forum post references a completely different mapping. The wiki page is basically empty.

</info>
<controller id="CMD">
<scriptfiles>
<file functionprefix="CMDPL1" filename="Behringer-CMD-PL-1-scripts.js"/>
</scriptfiles>
<controls>
<control>
<group>[Channel1]</group>
<key>play</key> i
<description>Play</description> i
<status>0x90</status> i
Comment on lines +17 to +19
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typos resulting in invalid XML

<midino>0x23</midino>
<options> <switch/> </options>
</control>
<control>
<group>[Channel2]</group>
<key>play</key>
<description>Play</description>
<status>0x91</status>
<midino>0x23</midino>
<options> <switch/> </options>
</control>
Comment on lines +15 to +30
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the mapping to two different channels?
these should be <normal/> and probably also need a midi note-off mapping.

<control>
<group>[Channel1]</group>
<key>cue_default</key>
<description>Cue</description>
<status>0x90</status>
<midino>0x22</midino>
<options> <switch/> </options> </control>
<control>
<group>[Channel2]</group>
<key>cue_default</key>
<description>Cue</description>
<status>0x91</status>
<midino>0x22</midino>
<options> <switch/> </options>
</control>
<control>
<group>[Channel1]</group>
<key>CMDPL1.wheelTurn</key>
<status>0xB0</status>
<midino>0x1F</midino>
<options> <script-binding/> </options>
</control>
<control>
<group>[Channel2]</group>
<key>CMDPL1.wheelTurn</key>
<status>0xB1</status>
<midino>0x1F</midino>
<options> <script-binding/> </options>
</control>
<control>
<group>[Channel1]</group>
<key>CMDPL1.pitchSlider</key>
<status>0xE0</status>
<options> <script-binding/> </options>
</control>
<control>
<group>[Channel2]</group>
<key>CMDPL1.pitchSlider</key>
<status>0xE1</status>
<options> <script-binding/> </options>
</control>
</controls>
<outputs/>
</controller>
</MixxxControllerPreset>
48 changes: 48 additions & 0 deletions res/controllers/Behringer-CMD-PL-1-scripts.js
Original file line number Diff line number Diff line change
@@ -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");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need the this, and please remove the unnecessary comments.

//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
}
Comment on lines +25 to +47
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you were only supposed to use either implementation, nevertheless, actually scratching won't work either because you never actually map the wheeltouch.

};