diff --git a/res/controllers/Numark_DJ2GO2_Touch.midi.xml b/res/controllers/Numark_DJ2GO2_Touch.midi.xml new file mode 100644 index 00000000000..045fcd8d3a1 --- /dev/null +++ b/res/controllers/Numark_DJ2GO2_Touch.midi.xml @@ -0,0 +1,959 @@ + + + + Numark DJ2GO2 Touch + tandy1000 + Numark DJ2GO2 Touch Mapping + + + + + + + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.loadButton.input + 0x8F + 0x02 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.loadButton.input + 0x9F + 0x02 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.wheelTouch + 0x80 + 0x06 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.wheelTouch + 0x90 + 0x06 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.wheelTurn + 0xB0 + 0x06 + + + + --> + + [Channel1] + DJ2GO2Touch.leftDeck.beatloopButtons[1].input + 0x84 + 0x11 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.beatloopButtons[1].input + 0x94 + 0x11 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.beatloopButtons[2].input + 0x84 + 0x12 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.beatloopButtons[2].input + 0x94 + 0x12 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.beatloopButtons[3].input + 0x84 + 0x13 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.beatloopButtons[3].input + 0x94 + 0x13 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.beatloopButtons[4].input + 0x84 + 0x14 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.beatloopButtons[4].input + 0x94 + 0x14 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.cueButton.input + 0x80 + 0x01 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.cueButton.input + 0x90 + 0x01 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.hotcueButtons[1].input + 0x84 + 0x01 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.hotcueButtons[1].input + 0x94 + 0x01 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.hotcueButtons[2].input + 0x84 + 0x02 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.hotcueButtons[2].input + 0x94 + 0x02 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.hotcueButtons[3].input + 0x84 + 0x03 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.hotcueButtons[3].input + 0x94 + 0x03 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.hotcueButtons[4].input + 0x84 + 0x04 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.hotcueButtons[4].input + 0x94 + 0x04 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.loopIn.input + 0x84 + 0x21 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.loopIn.input + 0x94 + 0x21 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.loopOut.input + 0x84 + 0x22 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.loopOut.input + 0x94 + 0x22 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.reLoopStop.input + 0x84 + 0x24 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.reLoopStop.input + 0x94 + 0x24 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.pflButton.input + 0x80 + 0x1B + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.pflButton.input + 0x90 + 0x1B + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.playButton.input + 0x80 + 0x00 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.playButton.input + 0x90 + 0x00 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.tempoFader.inputMSB + 0xB0 + 0x09 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.tempoFader.inputLSB + 0xB0 + 0x09 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.LoopToggleButton.input + 0x84 + 0x23 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.LoopToggleButton.input + 0x94 + 0x23 + + + + + + [QuickEffectRack1_[Channel1]] + DJ2GO2Touch.leftDeck.preGain.input + 0xB0 + 0x16 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.syncButton.input + 0x80 + 0x02 + + + + + + [Channel1] + DJ2GO2Touch.leftDeck.syncButton.input + 0x90 + 0x02 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.loadButton.input + 0x8F + 0x03 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.loadButton.input + 0x9F + 0x03 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.wheelTouch + 0x81 + 0x06 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.wheelTouch + 0x91 + 0x06 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.wheelTurn + 0xB1 + 0x06 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.beatloopButtons[1].input + 0x85 + 0x11 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.beatloopButtons[1].input + 0x95 + 0x11 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.beatloopButtons[2].input + 0x85 + 0x12 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.beatloopButtons[2].input + 0x95 + 0x12 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.beatloopButtons[3].input + 0x85 + 0x13 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.beatloopButtons[3].input + 0x95 + 0x13 + + + + + + [Channel1] + DJ2GO2Touch.rightDeck.beatloopButtons[4].input + 0x85 + 0x14 + + + + + + [Channel1] + DJ2GO2Touch.rightDeck.beatloopButtons[4].input + 0x95 + 0x14 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.cueButton.input + 0x81 + 0x01 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.cueButton.input + 0x91 + 0x01 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.hotcueButtons[1].input + 0x85 + 0x01 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.hotcueButtons[1].input + 0x95 + 0x01 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.hotcueButtons[2].input + 0x85 + 0x02 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.hotcueButtons[2].input + 0x95 + 0x02 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.hotcueButtons[3].input + 0x85 + 0x03 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.hotcueButtons[3].input + 0x95 + 0x03 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.hotcueButtons[4].input + 0x85 + 0x04 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.hotcueButtons[4].input + 0x95 + 0x04 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.loopIn.input + 0x85 + 0x21 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.loopIn.input + 0x95 + 0x21 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.loopOut.input + 0x85 + 0x22 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.reLoopStop.input + 0x95 + 0x24 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.reLoopStop.input + 0x95 + 0x24 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.pflButton.input + 0x81 + 0x1B + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.pflButton.input + 0x91 + 0x1B + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.playButton.input + 0x81 + 0x00 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.playButton.input + 0x91 + 0x00 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.tempoFader.inputMSB + 0xB1 + 0x09 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.tempoFader.inputLSB + 0xB1 + 0x09 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.LoopToggleButton.input + 0x85 + 0x23 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.LoopToggleButton.input + 0x95 + 0x23 + + + + + + [QuickEffectRack1_[Channel2]] + DJ2GO2Touch.rightDeck.preGain.input + 0xB1 + 0x16 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.syncButton.input + 0x81 + 0x02 + + + + + + [Channel2] + DJ2GO2Touch.rightDeck.syncButton.input + 0x91 + 0x02 + + + + + + [Library] + DJ2GO2Touch.browseEncoder.input + BROWSER KNOB + 0xBF + 0x00 + + + + + + [Library] + DJ2GO2Touch.browseEncoder.input + BROWSER KNOB PRESS + 0x8F + 0x06 + + + + + + [Library] + DJ2GO2Touch.browseEncoder.input + BROWSER KNOB PRESS + 0x9F + 0x06 + + + + + + [Master] + DJ2GO2Touch.crossfader.inputMSB + 0xBF + 0x08 + + + + + + [Master] + DJ2GO2Touch.crossfader.inputLSB + 0xBF + 0x08 + + + + + + [Master] + DJ2GO2Touch.masterGain.inputMSB + 0xBF + 0x0A + + + + + + [Master] + DJ2GO2Touch.masterGain.inputLSB + 0xBF + 0x0A + + + + + + [Master] + DJ2GO2Touch.cueGain.inputMSB + 0xBF + 0x0C + + + + + + [Master] + DJ2GO2Touch.cueGain.inputLSB + 0xBF + 0x0C + + + + + + [Sampler1] + DJ2GO2Touch.leftDeck.samplerButtons[1].input + 0x84 + 0x31 + + + + + + [Sampler1] + DJ2GO2Touch.leftDeck.samplerButtons[1].input + 0x94 + 0x31 + + + + + + [Sampler2] + DJ2GO2Touch.leftDeck.samplerButtons[2].input + 0x84 + 0x32 + + + + + + [Sampler2] + DJ2GO2Touch.leftDeck.samplerButtons[2].input + 0x94 + 0x32 + + + + + + [Sampler3] + DJ2GO2Touch.leftDeck.samplerButtons[3].input + 0x84 + 0x33 + + + + + + [Sampler3] + DJ2GO2Touch.leftDeck.samplerButtons[3].input + 0x94 + 0x33 + + + + + + [Sampler4] + DJ2GO2Touch.leftDeck.samplerButtons[4].input + 0x84 + 0x34 + + + + + + [Sampler4] + DJ2GO2Touch.leftDeck.samplerButtons[4].input + 0x94 + 0x34 + + + + + + [Sampler5] + DJ2GO2Touch.rightDeck.samplerButtons[1].input + 0x85 + 0x31 + + + + + + [Sampler5] + DJ2GO2Touch.rightDeck.samplerButtons[1].input + 0x95 + 0x31 + + + + + + [Sampler6] + DJ2GO2Touch.rightDeck.samplerButtons[2].input + 0x85 + 0x32 + + + + + + [Sampler6] + DJ2GO2Touch.rightDeck.samplerButtons[2].input + 0x95 + 0x32 + + + + + + [Sampler7] + DJ2GO2Touch.rightDeck.samplerButtons[3].input + 0x85 + 0x33 + + + + + + [Sampler7] + DJ2GO2Touch.rightDeck.samplerButtons[3].input + 0x95 + 0x33 + + + + + + [Sampler8] + DJ2GO2Touch.rightDeck.samplerButtons[4].input + 0x85 + 0x34 + + + + + + [Sampler8] + DJ2GO2Touch.rightDeck.samplerButtons[4].input + 0x95 + 0x34 + + + + + + + + diff --git a/res/controllers/Numark_DJ2GO2_Touch_scripts.js b/res/controllers/Numark_DJ2GO2_Touch_scripts.js new file mode 100644 index 00000000000..eaa0a843b2b --- /dev/null +++ b/res/controllers/Numark_DJ2GO2_Touch_scripts.js @@ -0,0 +1,171 @@ +var DJ2GO2Touch = {}; +DJ2GO2Touch.ControllerStatusSysex = [0xF0, 0x00, 0x20, 0x7F, 0x03, 0x01, 0xF7]; +DJ2GO2Touch.padsPerDeck = 4; + +DJ2GO2Touch.init = function() { + DJ2GO2Touch.leftDeck = new DJ2GO2Touch.Deck([1], 0); + DJ2GO2Touch.rightDeck = new DJ2GO2Touch.Deck([2], 1); + midi.sendSysexMsg(DJ2GO2Touch.ControllerStatusSysex, DJ2GO2Touch.ControllerStatusSysex.length); +}; + +DJ2GO2Touch.shutdown = function() { + DJ2GO2Touch.leftDeck.shutdown(); + DJ2GO2Touch.rightDeck.shutdown(); +}; + +DJ2GO2Touch.browseEncoder = new components.Encoder({ + previewSeekEnabled: false, + onKnobEvent: function(rotateValue) { + if (rotateValue !== 0) { + if (this.previewSeekEnabled && engine.getValue("[PreviewDeck1]", "play")) { + var oldPos = engine.getValue("[PreviewDeck1]", "playposition"); + var newPos = Math.max(0, oldPos + (0.05 * rotateValue)); + engine.setValue("[PreviewDeck1]", "playposition", newPos); + } else if (!this.previewSeekEnabled) { + engine.setValue("[Playlist]", "SelectTrackKnob", rotateValue); + } + } + }, + onButtonEvent: function() { + if (engine.getValue("[PreviewDeck1]", "play")) { + script.triggerControl("[PreviewDeck1]", "stop"); + this.previewSeekEnabled = false; + } else { + engine.setValue("[PreviewDeck1]", "LoadSelectedTrackAndPlay", 1); + this.previewSeekEnabled = true; + } + }, + input: function(channel, control, value, status, _group) { + switch (status) { + case 0xBF: + var rotateValue = (value === 127) ? -1 : ((value === 1) ? 1 : 0); + this.onKnobEvent(rotateValue); + break; + case 0x9F: + this.onButtonEvent(); + } + } +}); + +DJ2GO2Touch.masterGain = new components.Pot({ + midi: [0xBF, 0x0A], + group: "[Master]", + key: "gain" +}); + +DJ2GO2Touch.cueGain = new components.Pot({ + midi: [0xBF, 0x0C], + group: "[Master]", + key: "headGain" +}); + +DJ2GO2Touch.crossfader = new components.Pot({ + midi: [0xBF, 0x08], + group: "[Master]", + key: "crossfader" +}); + +DJ2GO2Touch.Deck = function(deckNumbers, midiChannel) { + components.Deck.call(this, deckNumbers); + this.playButton = new components.PlayButton([0x90 + midiChannel, 0x00]); + this.cueButton = new components.CueButton([0x90 + midiChannel, 0x01]); + this.syncButton = new components.SyncButton([0x90 + midiChannel, 0x02]); + + this.pflButton = new components.Button({ + midi: [0x90 + midiChannel, 0x1B], + key: "pfl" + }); + + this.loadButton = new components.Button({ + midi: [0x9F, 0x02 + midiChannel], + key: "LoadSelectedTrack", + input: function(channel, control, value, status, _group) { + this.send(this.isPress(channel, control, value, status) ? this.on : this.off); + components.Button.prototype.input.apply(this, arguments); + } + }); + + this.preGain = new components.Pot({ + midi: [0xB0 + midiChannel, 0x16], + group: "[QuickEffectRack1_" + this.currentDeck + "]", + key: "super1" + }); + + engine.setValue(this.currentDeck, "rate_dir", -1); + this.tempoFader = new components.Pot({ + group: "[Channel" + script.deckFromGroup(this.currentDeck) + "]", + midi: [0xB0 + midiChannel, 0x09], + key: "rate" + }); + + this.hotcueButtons = []; + this.samplerButtons = []; + this.beatloopButtons = []; + for (var i = 1; i <= 4; i++) { + this.hotcueButtons[i] = new components.HotcueButton({ + group: "[Channel" + script.deckFromGroup(this.currentDeck) + "]", + midi: [0x94 + midiChannel, 0x01 + i], + number: i + }); + var sampler = i + (midiChannel * DJ2GO2Touch.padsPerDeck); + this.samplerButtons[i] = new components.SamplerButton({ + group: "[Sampler" + sampler + "]", + midi: [0x94 + midiChannel, 0x31 + i], + number: sampler + }); + this.beatloopButtons[i] = new components.Button({ + group: "[Channel" + script.deckFromGroup(this.currentDeck) + "]", + midi: [0x94 + midiChannel, 0x11 + i], + number: i, + key: "beatloop_" + Math.pow(2, i-1) + "_toggle" + }); + } + + this.loopIn = new components.Button({ + midi: [0x94 + midiChannel, 0x21], + key: "loop_in", + }); + + this.loopOut = new components.Button({ + midi: [0x94 + midiChannel, 0x22], + key: "loop_out", + }); + + this.LoopToggleButton = new components.LoopToggleButton([0x94 + midiChannel, 0x23]); + + this.reLoopStop = new components.Button({ + midi: [0x94 + midiChannel, 0x24], + key: "reloop_andstop", + }); + + this.wheelTouch = function(channel, control, value, status, _group) { + if ((status & 0xF0) === 0x90) { + var alpha = 1.0/8; + var beta = alpha/32; + engine.scratchEnable(script.deckFromGroup(this.currentDeck), 236, 33+1/3, alpha, beta); + } else { + engine.scratchDisable(script.deckFromGroup(this.currentDeck)); + } + }; + + this.wheelTurn = function(channel, control, value, _status, _group) { + // When the jog wheel is turned in counter-clockwise direction, value is + // greater than 64 (= 0x40). If it's turned in clockwise + // direction, the value is smaller than 64. + var newValue = value > 64 ? (value - 128) : value; + var deck = script.deckFromGroup(this.currentDeck); + if (engine.isScratching(deck)) { + engine.scratchTick(deck, newValue); // Scratch! + } else { + engine.setValue(this.currentDeck, "jog", newValue); // Pitch bend + } + }; + + this.reconnectComponents(function(c) { + if (c.group === undefined) { + c.group = this.currentDeck; + } + }); +}; + +DJ2GO2Touch.Deck.prototype = new components.Deck();