diff options
author | Nathan Korth <nkorth@nkorth.com> | 2020-05-25 13:25:55 -0400 |
---|---|---|
committer | Nathan Korth <nkorth@nkorth.com> | 2020-06-13 14:57:29 -0400 |
commit | d354b5fb14c902a55f467b3671b73b06c3546fbe (patch) | |
tree | d5ae6273fc51bbcd50d1945b7ce4f0ee2b4cd734 | |
parent | 1f3fc6e97bf7a46c531aaa1ffa83010955ab6404 (diff) |
Mapping for Numark iDJ Live II
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | res/controllers/Numark iDJ Live II.midi.xml | 339 | ||||
-rw-r--r-- | res/controllers/Numark-iDJ-Live-II-scripts.js | 117 |
3 files changed, 457 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index ff2d136a33..6fd4bf80ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,7 @@ * Add logging when script ControlObject callback is disconnected successfully [#2054](https://github.com/mixxxdj/mixxx/pull/2054) * Add controller mapping for Roland DJ-505 [#2111](https://github.com/mixxxdj/mixxx/pull/2111) * Update controller mapping for Allen & Heath Xone K2 to add intro/outro cues [#2236](https://github.com/mixxxdj/mixxx/pull/2236) +* Add controller mapping for Numark iDJ Live II [#2818](https://github.com/mixxxdj/mixxx/pull/2818) ### Development ### * Add CMake build system with Ccache support for faster compilation time [#2280](https://github.com/mixxxdj/mixxx/pull/2280) diff --git a/res/controllers/Numark iDJ Live II.midi.xml b/res/controllers/Numark iDJ Live II.midi.xml new file mode 100644 index 0000000000..ee0fb02ea4 --- /dev/null +++ b/res/controllers/Numark iDJ Live II.midi.xml @@ -0,0 +1,339 @@ +<?xml version='1.0' encoding='utf-8'?> +<MixxxControllerPreset mixxxVersion="2.2.3" schemaVersion="1"> + <info> + <name>Numark iDJ Live II</name> + <author>Nathan Korth</author> + <description>Complete mapping for iDJ Live II</description> + <wiki>https://mixxx.org/wiki/doku.php/numark_idj_live_ii</wiki> + </info> + <controller id="Numark"> + <scriptfiles> + <file functionprefix="Numark" filename="Numark-iDJ-Live-II-scripts.js"/> + </scriptfiles> + <controls> + <!-- Master --> + <control> + <group>[Master]</group> + <key>Numark.toggleScratchMode</key> + <status>0x90</status> + <midino>0x48</midino> + <options> + <script-binding/> + </options> + </control> + <control> + <group>[Master]</group> + <key>gain</key> + <status>0xB0</status> + <midino>0x17</midino> + </control> + <control> + <group>[Master]</group> + <key>crossfader</key> + <status>0xB0</status> + <midino>0x0A</midino> + <options> + <invert/> + </options> + </control> + <!-- Library --> + <control> + <group>[Library]</group> + <key>MoveVertical</key> + <status>0xB0</status> + <midino>0x1A</midino> + <options> + <selectknob/> + </options> + </control> + <control> + <group>[Master]</group> + <key>maximize_library</key> + <status>0x90</status> + <midino>0x4F</midino> + </control> + <control> + <group>[Channel1]</group> + <key>LoadSelectedTrack</key> + <status>0x90</status> + <midino>0x4B</midino> + </control> + <control> + <group>[Channel2]</group> + <key>LoadSelectedTrack</key> + <status>0x90</status> + <midino>0x34</midino> + </control> + <!-- Deck 1 jog --> + <control> + <group>[Channel1]</group> + <key>Numark.jogTouch</key> + <status>0x90</status> + <midino>0x4D</midino> + <options> + <script-binding/> + </options> + </control> + <control> + <group>[Channel1]</group> + <key>Numark.jogTouch</key> + <status>0x80</status> + <midino>0x4D</midino> + <options> + <script-binding/> + </options> + </control> + <control> + <group>[Channel1]</group> + <key>Numark.jog</key> + <status>0xB0</status> + <midino>0x19</midino> + <options> + <script-binding/> + </options> + </control> + <!-- Deck 1 knobs --> + <control> + <group>[Channel1]</group> + <key>volume</key> + <status>0xB0</status> + <midino>0x08</midino> + </control> + <control> + <group>[EqualizerRack1_[Channel1]_Effect1]</group> + <key>parameter1</key> + <status>0xB0</status> + <midino>0x14</midino> + </control> + <control> + <group>[EqualizerRack1_[Channel1]_Effect1]</group> + <key>parameter3</key> + <status>0xB0</status> + <midino>0x10</midino> + </control> + <!-- Deck 1 buttons --> + <control> + <group>[Channel1]</group> + <key>play</key> + <status>0x90</status> + <midino>0x4A</midino> + </control> + <control> + <group>[Channel1]</group> + <key>play</key> + <status>0x80</status> + <midino>0x4A</midino> + </control> + <control> + <group>[Channel1]</group> + <key>cue_goto</key> + <status>0x90</status> + <midino>0x3B</midino> + </control> + <control> + <group>[Channel1]</group> + <key>cue_goto</key> + <status>0x80</status> + <midino>0x3B</midino> + </control> + <control> + <group>[Channel1]</group> + <key>cue_set</key> + <status>0x90</status> + <midino>0x33</midino> + </control> + <control> + <group>[Channel1]</group> + <key>cue_set</key> + <status>0x80</status> + <midino>0x33</midino> + </control> + <control> + <group>[Channel1]</group> + <key>sync_enabled</key> + <status>0x90</status> + <midino>0x40</midino> + </control> + <control> + <group>[Channel1]</group> + <key>sync_enabled</key> + <status>0x80</status> + <midino>0x40</midino> + </control> + <control> + <group>[Channel1]</group> + <key>rate_temp_up</key> + <status>0x90</status> + <midino>0x43</midino> + </control> + <control> + <group>[Channel1]</group> + <key>rate_temp_up</key> + <status>0x80</status> + <midino>0x43</midino> + </control> + <control> + <group>[Channel1]</group> + <key>rate_temp_down</key> + <status>0x90</status> + <midino>0x44</midino> + </control> + <control> + <group>[Channel1]</group> + <key>rate_temp_down</key> + <status>0x80</status> + <midino>0x44</midino> + </control> + <!-- Deck 2 jog --> + <control> + <group>[Channel2]</group> + <key>Numark.jogTouch</key> + <status>0x90</status> + <midino>0x4E</midino> + <options> + <script-binding/> + </options> + </control> + <control> + <group>[Channel2]</group> + <key>Numark.jogTouch</key> + <status>0x80</status> + <midino>0x4E</midino> + <options> + <script-binding/> + </options> + </control> + <control> + <group>[Channel2]</group> + <key>Numark.jog</key> + <status>0xB0</status> + <midino>0x18</midino> + <options> + <script-binding/> + </options> + </control> + <!-- Deck 2 knobs --> + <control> + <group>[Channel2]</group> + <key>volume</key> + <status>0xB0</status> + <midino>0x09</midino> + </control> + <control> + <group>[EqualizerRack1_[Channel2]_Effect1]</group> + <key>parameter1</key> + <status>0xB0</status> + <midino>0x15</midino> + </control> + <control> + <group>[EqualizerRack1_[Channel2]_Effect1]</group> + <key>parameter3</key> + <status>0xB0</status> + <midino>0x11</midino> + </control> + <!-- Deck 2 buttons --> + <control> + <group>[Channel2]</group> + <key>play</key> + <status>0x90</status> + <midino>0x4C</midino> + </control> + <control> + <group>[Channel2]</group> + <key>play</key> + <status>0x80</status> + <midino>0x4C</midino> + </control> + <control> + <group>[Channel2]</group> + <key>cue_goto</key> + <status>0x90</status> + <midino>0x42</midino> + </control> + <control> + <group>[Channel2]</group> + <key>cue_goto</key> + <status>0x80</status> + <midino>0x42</midino> + </control> + <control> + <group>[Channel2]</group> + <key>cue_set</key> + <status>0x90</status> + <midino>0x3C</midino> + </control> + <control> + <group>[Channel2]</group> + <key>cue_set</key> + <status>0x80</status> + <midino>0x3C</midino> + </control> + <control> + <group>[Channel2]</group> + <key>sync_enabled</key> + <status>0x90</status> + <midino>0x47</midino> + </control> + <control> + <group>[Channel2]</group> + <key>sync_enabled</key> + <status>0x80</status> + <midino>0x47</midino> + </control> + <control> + <group>[Channel2]</group> + <key>rate_temp_up</key> + <status>0x90</status> + <midino>0x45</midino> + </control> + <control> + <group>[Channel2]</group> + <key>rate_temp_up</key> + <status>0x80</status> + <midino>0x45</midino> + </control> + <control> + <group>[Channel2]</group> + <key>rate_temp_down</key> + <status>0x90</status> + <midino>0x46</midino> + </control> + <control> + <group>[Channel2]</group> + <key>rate_temp_down</key> + <status>0x80</status> + <midino>0x46</midino> + </control> + </controls> + <outputs> + <output> + <group>[Channel1]</group> + <key>play_indicator</key> + <status>0x90</status> + <midino>0x4A</midino> + <minimum>0.5</minimum> + </output> + <output> + <group>[Channel2]</group> + <key>play_indicator</key> + <status>0x90</status> + <midino>0x4C</midino> + <minimum>0.5</minimum> + </output> + <output> + <group>[Channel1]</group> + <key>sync_enabled</key> + <status>0x90</status> + <midino>0x40</midino> + <minimum>0.5</minimum> + </output> + <output> + <group>[Channel2]</group> + <key>sync_enabled</key> + <status>0x90</status> + <midino>0x47</midino> + <minimum>0.5</minimum> + </output> + </outputs> + </controller> +</MixxxControllerPreset> diff --git a/res/controllers/Numark-iDJ-Live-II-scripts.js b/res/controllers/Numark-iDJ-Live-II-scripts.js new file mode 100644 index 0000000000..b09c1d28a7 --- /dev/null +++ b/res/controllers/Numark-iDJ-Live-II-scripts.js @@ -0,0 +1,117 @@ +var Numark = {}; + +// yanked from the Virtual DJ config on Numark's website +Numark.sysex = [0xF0, 0x00, 0x01, 0x3F, 0x7F, 0x2E, 0x60, 0x00, 0x01, 0x01, 0xF7]; + +Numark.jogResolution = 640; + +Numark.buttons = { + "[Channel1]": { + "play": 0x4A, + "sync": 0x40, + }, + "[Channel2]": { + "play": 0x4C, + "sync": 0x47, + }, + "scratch": 0x48, +}; + +Numark.ledOn = function(control) { + midi.sendShortMsg(0x90, control, 0x7f); +}; +Numark.ledOff = function(control) { + midi.sendShortMsg(0x90, control, 0x00); +}; + +Numark.init = function() { + this.touching = { + "[Channel1]": false, + "[Channel2]": false, + }; + // tell controller to send current state of knobs and crossfader + midi.sendSysexMsg(this.sysex, this.sysex.length); + // change this line to toggle the default scratch mode: + this.scratchMode = true; + // initialize LEDs + if (this.scratchMode) { + this.ledOn(this.buttons.scratch); + } else { + this.ledOff(this.buttons.scratch); + } + if (engine.getParameter("[Channel1]", "play")) { + this.ledOn(this.buttons["[Channel1]"].play); + } else { + this.ledOff(this.buttons["[Channel1]"].play); + } + if (engine.getParameter("[Channel2]", "play")) { + this.ledOn(this.buttons["[Channel2]"].play); + } else { + this.ledOff(this.buttons["[Channel2]"].play); + } +}; + +Numark.shutdown = function() { + this.ledOff(this.buttons["[Channel1]"].play); + this.ledOff(this.buttons["[Channel1]"].sync); + this.ledOff(this.buttons["[Channel2]"].play); + this.ledOff(this.buttons["[Channel2]"].sync); + this.ledOff(this.buttons.scratch); +}; + +Numark.toggleScratchMode = function() { + if (this.scratchMode) { + this.scratchMode = false; + this.ledOff(this.buttons.scratch); + // cancel any active scratches to prevent weird behavior + engine.scratchDisable(1); + engine.scratchDisable(2); + } else { + this.scratchMode = true; + this.ledOn(this.buttons.scratch); + } +}; + +Numark.jogTouch = function(_channel, _control, value, _status, group) { + var deckN = script.deckFromGroup(group); + if (value >= 64) { + this.touching[group] = true; + if (this.scratchMode) { + var alpha = 1.0/8; + var beta = alpha/32; + engine.scratchEnable(deckN, this.jogResolution, 33+(1.0/3), alpha, beta); + } + } else { + this.touching[group] = false; + engine.scratchDisable(deckN); + } +}; + +Numark.jog = function(_channel, _control, value, _status, group) { + if (!this.touching[group]) { + return; + } + // value is centered around 0 + if (value >= 64) { + value -= 128; + } + var deckN = script.deckFromGroup(group); + if (this.scratchMode) { + if (engine.isScratching(deckN)) { + engine.scratchTick(deckN, value); + } + } else { + if (engine.getParameter(group, "play")) { + // pitch bend while playing + engine.setValue(group, "jog", value); + } else { + // search while paused + var position = engine.getValue(group, "playposition"); + position += value * 0.0002; + if (position < 0) { + position = 0; + } + engine.setValue(group, "playposition", position); + } + } +}; |