Hey martibs,
I followed the approach used on the MC3000 script and modified it to make the script for the Denon MC2000 (you can download it and take a look for details).
I first got the MIDI reception commands from the spec sheet (found it just by using Google since it wasn’t included with my controller) and put them in an associative array.
// MIDI Reception commands (from spec)
mc2000.leds = {
cue1: 17,
cue2: 19,
cue3: 21,
cue4: 23,
samp1_l: 25,
samp2_l: 27,
samp3_l: 29,
samp4_l: 32,
samples_l: 35,
samp1_r: 65,
samp2_r: 67,
samp3_r: 69,
samp4_r: 71,
samples_r: 73,
cue: 38,
play: 39
// etc.
};
Defined a function like this for every bound control:
mc2000.playSetLed = function(value, group) {
mc2000.setLed(mc2000.group2Deck(group),mc2000.leds["play"],value);
};
The group2Deck function converts the group string to the Deck number. An if-elseif-else flow would work too.
mc2000.group2Deck = function(group) {
var matches = group.match(/^\[Channel(\d+)\]$/);
if (matches == null) {
return -1;
} else {
return matches[1];
}
};
And the setLed function which translates the status (given by mixxx) to the ledStatus code (from the spec sheet). The first parameter in sendShortMsg is the MIDI channel for the corresponding deck (0xB0 or 0xB1, from the spec again, for deck 1 or 2).
mc2000.setLed = function(deck,led,status) {
var ledStatus = 0x4B; // Default OFF
switch (status) {
case 0: ledStatus = 0x4B; break; // OFF
case false: ledStatus = 0x4B; break; // OFF
case 1: ledStatus = 0x4A; break; // ON
case true: ledStatus = 0x4A; break; // ON
case 2: ledStatus = 0x4C; break; // BLINK
default: break;
}
midi.sendShortMsg(0xB0+(deck-1), ledStatus, led);
};
What is good to do is to bind the mixxx controls to the appropiate buttons so that they show the correct status automatically (play lights up when playing, and lights off when not). I did this in the init function. The loop is just to avoid typing Channel1, Channel2 and having too much duplicate code.
[code]// Called when the MIDI device is opened & set up.
mc2000.init = function(id, debug) {
mc2000.id = id;
mc2000.debug = debug;
// ---- Connect controls -----------
// ---- Controls for Channel 1 and 2
var i=0;
for (i=1; i<=2; i++) {
// Key lock
engine.connectControl("[Channel"+i+"]", "keylock", "mc2000.keylockSetLed");
// Sync
engine.connectControl("[Channel"+i+"]", "beat_active", "mc2000.beatActiveSetLed");
// Cue
engine.connectControl("[Channel"+i+"]", "cue_default", "mc2000.cueSetLed");
// Play
engine.connectControl("[Channel"+i+"]", "play", "mc2000.playSetLed");
// etc...
}
};[/code]
Since the controls are connected but the default functionality is used, I didn’t need to do a script-binding in the xml for the play button at least. Be sure to map the press and release codes (the wizard didn’t add them all for me on deck 2). Here is the relevant part of the midi.xml for my play buttons:
<control>
<group>[Channel1]</group>
<key>play</key>
<status>0x80</status>
<midino>0x43</midino>
<options>
<normal/>
</options>
</control>
<control>
<group>[Channel2]</group>
<key>play</key>
<status>0x81</status>
<midino>0x43</midino>
<options>
<normal/>
</options>
</control>
<control>
<group>[Channel1]</group>
<key>play</key>
<status>0x90</status>
<midino>0x43</midino>
<options>
<normal/>
</options>
</control>
<control>
<group>[Channel2]</group>
<key>play</key>
<status>0x91</status>
<midino>0x43</midino>
<options>
<normal/>
</options>
</control>
Hope it helps, once you get one going the rest is very straight-forward 