From c99a370e3235489541bf597f65e57b5e4f1a619a Mon Sep 17 00:00:00 2001 From: Mel Grubb Date: Wed, 15 Feb 2017 12:22:28 -0500 Subject: [PATCH 01/20] M-Audio Xponent (Advanced) mapping added --- .../M-Audio Xponent (Advanced).midi.xml | 1628 +++++++++++++++++ .../M-Audio-Xponent-Advanced-scripts.js | 689 +++++++ 2 files changed, 2317 insertions(+) create mode 100644 res/controllers/M-Audio Xponent (Advanced).midi.xml create mode 100644 res/controllers/M-Audio-Xponent-Advanced-scripts.js diff --git a/res/controllers/M-Audio Xponent (Advanced).midi.xml b/res/controllers/M-Audio Xponent (Advanced).midi.xml new file mode 100644 index 000000000000..b72e4d2dd2c6 --- /dev/null +++ b/res/controllers/M-Audio Xponent (Advanced).midi.xml @@ -0,0 +1,1628 @@ + + + + M-Audio Xponent (Advanced) + Mel Grubb, Luca Franceschini, Juan Pedro BolĂ­var Puente + + Advanced mapping for the M-Audio Xponent controller. + Includes Samplers, Effects, Loops, Hotcues, and more. See Wiki for details. + Make sure to set the bank switch on the bottom of the Xponent to A. + + http://www.mixxx.org/forums/viewtopic.php?f=7&t=8884 + http://www.mixxx.org/wiki/doku.php/m-audio_xponent + + + + + + + + [Channel1] + MaudioXponent.secondaryoff + 0x80 + 0x2C + + + + + + [Channel2] + MaudioXponent.secondaryoff + 0x81 + 0x2C + + + + + + [Channel1] + MaudioXponent.beatgridLoop + Loop 8 release + 0x80 + 0x28 + + + + + + [Channel2] + MaudioXponent.beatgridLoop + Loop 8 release + 0x81 + 0x28 + + + + + + [Channel1] + MaudioXponent.beatgridLoop + Loop 4 release + 0x80 + 0x27 + + + + + + [Channel2] + MaudioXponent.beatgridLoop + Loop 4 release + 0x81 + 0x27 + + + + + + [Channel1] + MaudioXponent.beatgridLoop + Loop 2 release + 0x80 + 0x26 + + + + + + [Channel2] + MaudioXponent.beatgridLoop + Loop 2 release + 0x81 + 0x26 + + + + + + [Channel1] + MaudioXponent.beatgridLoop + Loop 1 release + 0x80 + 0x25 + + + + + + [Channel2] + MaudioXponent.beatgridLoop + Loop 1 release + 0x81 + 0x25 + + + + + + [Channel1] + play + button + 0x80 + 0x24 + + + + + + [Channel2] + play + button + 0x81 + 0x24 + + + + + + [Channel1] + MaudioXponent.cuedefoff + 0x80 + 0x23 + + + + + + [Channel2] + MaudioXponent.cuedefoff + 0x81 + 0x23 + + + + + + [Channel1] + MaudioXponent.actbinstop + 0x80 + 0x22 + + + + + + [Channel2] + MaudioXponent.actbinstop + 0x81 + 0x22 + + + + + + [Channel1] + MaudioXponent.actbinstop + 0x80 + 0x21 + + + + + + [Channel2] + MaudioXponent.actbinstop + 0x81 + 0x21 + + + + + + [Channel1] + rate_perm_down + Speed-- + 0x80 + 0x20 + + + + + + [Channel2] + rate_perm_down + Speed-- + 0x81 + 0x20 + + + + + + [Channel1] + rate_perm_up + Speed++ + 0x80 + 0x1F + + + + + + [Channel2] + rate_perm_up + Speed++ + 0x81 + 0x1F + + + + + + [Channel1] + MaudioXponent.secondaryon + 0x90 + 0x2C + + + + + + [Channel2] + MaudioXponent.secondaryon + 0x91 + 0x2C + + + + + + [Channel1] + MaudioXponent.loopout + 0x90 + 0x2B + + + + + + [Channel1] + MaudioXponent.hotcue + Hotcue 5 release + 0x80 + 0x1B + + + + + + [Channel2] + MaudioXponent.loopout + 0x91 + 0x2B + + + + + + [Channel1] + MaudioXponent.loopexit + 0x90 + 0x2A + + + + + + [Channel2] + MaudioXponent.hotcue + Hotcue 5 release + 0x81 + 0x1B + + + + + + [Channel1] + MaudioXponent.hotcue + Hotcue 4 release + 0x80 + 0x1A + + + + + + [Channel2] + MaudioXponent.loopexit + 0x91 + 0x2A + + + + + + [Channel1] + MaudioXponent.loopin + 0x90 + 0x29 + + + + + + [Channel2] + MaudioXponent.hotcue + Hotcue 4 release + 0x81 + 0x1A + + + + + + [Channel1] + MaudioXponent.hotcue + Hotcue 3 release + 0x80 + 0x19 + + + + + + [Channel2] + MaudioXponent.loopin + 0x91 + 0x29 + + + + + + [Channel1] + MaudioXponent.beatgridLoop + Loop 8 press + 0x90 + 0x28 + + + + + + [Channel2] + MaudioXponent.hotcue + Hotcue 3 release + 0x81 + 0x19 + + + + + + [Channel1] + MaudioXponent.hotcue + Hotcue 2 release + 0x80 + 0x18 + + + + + + [Channel2] + MaudioXponent.beatgridLoop + Loop 8 press + 0x91 + 0x28 + + + + + + [Channel1] + MaudioXponent.beatgridLoop + Loop 4 press + 0x90 + 0x27 + + + + + + [Channel2] + MaudioXponent.hotcue + Hotcue 2 release + 0x81 + 0x18 + + + + + + [Channel1] + MaudioXponent.hotcue + Hotcue 1 release + 0x80 + 0x17 + + + + + + [Channel2] + MaudioXponent.beatgridLoop + Loop 4 press + 0x91 + 0x27 + + + + + + [Channel1] + MaudioXponent.beatgridLoop + Loop 2 press + 0x90 + 0x26 + + + + + + [Channel2] + MaudioXponent.hotcue + Hotcue 1 release + 0x81 + 0x17 + + + + + + [Channel1] + MaudioXponent.wheelTouch + 0x80 + 0x16 + + + + + + [Channel2] + MaudioXponent.beatgridLoop + Loop 2 press + 0x91 + 0x26 + + + + + + [Channel1] + MaudioXponent.beatgridLoop + Loop 1 press + 0x90 + 0x25 + + + + + + [Channel2] + MaudioXponent.wheelTouch + 0x81 + 0x16 + + + + + + [Channel2] + MaudioXponent.beatgridLoop + Loop 1 press + 0x91 + 0x25 + + + + + + [Channel1] + MaudioXponent.actbin + 0x90 + 0x24 + + + + + + [Channel1] + MaudioXponent.actbinstop + 0x80 + 0x13 + + + + + + [Channel2] + MaudioXponent.actbin + 0x91 + 0x24 + + + + + + [Channel1] + MaudioXponent.cuedefon + 0x90 + 0x23 + + + + + + [Channel2] + MaudioXponent.actbinstop + 0x81 + 0x13 + + + + + + [Channel1] + MaudioXponent.brake + 0x80 + 0x12 + + + + + + [Channel2] + MaudioXponent.cuedefon + 0x91 + 0x23 + + + + + + [Channel1] + MaudioXponent.actbin + 0x90 + 0x22 + + + + + + [Channel2] + MaudioXponent.brake + 0x81 + 0x12 + + + + + + [Channel1] + MaudioXponent.nudge + button + 0x80 + 0x11 + + + + + + [Channel2] + MaudioXponent.actbin + 0x91 + 0x22 + + + + + + [Channel1] + MaudioXponent.actbin + 0x90 + 0x21 + + + + + + [Channel2] + MaudioXponent.nudge + button + 0x81 + 0x11 + + + + + + [Channel1] + MaudioXponent.nudge + button + 0x80 + 0x10 + + + + + + [Channel2] + MaudioXponent.actbin + 0x91 + 0x21 + + + + + + [Channel1] + rate_perm_down + Speed-- + 0x90 + 0x20 + + + + + + [Channel2] + MaudioXponent.nudge + button + 0x81 + 0x10 + + + + + + [Channel2] + rate_perm_down + Speed-- + 0x91 + 0x20 + + + + + + [Channel1] + rate_perm_up + Speed++ + 0x90 + 0x1F + + + + + + [Channel2] + rate_perm_up + Speed++ + 0x91 + 0x1F + + + + + + [Channel1] + MaudioXponent.toggleKeylock + 0x90 + 0x1E + + + + + + [Channel2] + MaudioXponent.toggleKeylock + 0x91 + 0x1E + + + + + + [Channel1] + MaudioXponent.beatgridAdjust + 0x90 + 0x1D + + + + + + [Channel2] + MaudioXponent.beatgridAdjust + 0x91 + 0x1D + + + + + + [Channel1] + MaudioXponent.beatgridAdjust + 0x90 + 0x1C + + + + + + [Channel1] + MaudioXponent.volbuttonoff + 0x80 + 0x0B + + + + + + [Channel2] + MaudioXponent.beatgridAdjust + 0x91 + 0x1C + + + + + + [Channel1] + MaudioXponent.hotcue + Hotcue 5 press + 0x90 + 0x1B + + + + + + [Channel2] + MaudioXponent.volbuttonoff + 0x81 + 0x0B + + + + + + [Channel1] + filterHighKill + button + 0x80 + 0x0A + + + + + + [Channel2] + MaudioXponent.hotcue + Hotcue 5 press + 0x91 + 0x1B + + + + + + [Channel1] + MaudioXponent.hotcue + Hotcue 4 press + 0x90 + 0x1A + + + + + + [Channel2] + filterHighKill + button + 0x81 + 0x0A + + + + + + [Channel1] + filterMidKill + button + 0x80 + 0x09 + + + + + + [Channel2] + MaudioXponent.hotcue + Hotcue 4 press + 0x91 + 0x1A + + + + + + [Channel1] + MaudioXponent.hotcue + Hotcue 3 press + 0x90 + 0x19 + + + + + + [Channel1] + MaudioXponent.hotcue + Hotcue 2 press + 0x90 + 0x18 + + + + + + [Channel2] + filterMidKill + button + 0x81 + 0x09 + + + + + + [Channel1] + filterLowKill + button + 0x80 + 0x08 + + + + + + [Channel2] + MaudioXponent.hotcue + Hotcue 3 press + 0x91 + 0x19 + + + + + + [Channel2] + MaudioXponent.hotcue + Hotcue 2 press + 0x91 + 0x18 + + + + + + [Channel1] + MaudioXponent.hotcue + Hotcue 1 press + 0x90 + 0x17 + + + + + + [Channel2] + filterLowKill + button + 0x81 + 0x08 + + + + + + [Channel1] + MaudioXponent.punchIn + 0x80 + 0x07 + + + + + + [Channel2] + MaudioXponent.hotcue + Hotcue 1 press + 0x91 + 0x17 + + + + + + [Channel1] + MaudioXponent.wheelTouch + 0x90 + 0x16 + + + + + + [Channel2] + MaudioXponent.punchIn + 0x81 + 0x07 + + + + + + [Channel2] + MaudioXponent.wheelTouch + 0x91 + 0x16 + + + + + + [Channel1] + MaudioXponent.toggleScratchMode + 0x90 + 0x15 + + + + + + [Channel2] + MaudioXponent.toggleScratchMode + 0x91 + 0x15 + + + + + + [Channel1] + MaudioXponent.pfl + 0x90 + 0x14 + + + + + + [Channel2] + MaudioXponent.pfl + 0x91 + 0x14 + + + + + + [Channel1] + MaudioXponent.actbin + 0x90 + 0x13 + + + + + + [Channel2] + MaudioXponent.actbin + 0x91 + 0x13 + + + + + + [Channel1] + MaudioXponent.brake + 0x90 + 0x12 + + + + + + [Channel2] + MaudioXponent.brake + 0x91 + 0x12 + + + + + + [Channel1] + MaudioXponent.nudge + button + 0x90 + 0x11 + + + + + + [Channel2] + MaudioXponent.nudge + button + 0x91 + 0x11 + + + + + + [Channel1] + MaudioXponent.nudge + button + 0x90 + 0x10 + + + + + + [Channel2] + MaudioXponent.nudge + button + 0x91 + 0x10 + + + + + + [Sampler4] + cue_gotoandplay + 0x90 + 0x0F + + + + + + [Channel2] + MaudioXponent.fx + 0x91 + 0x0F + + + + + + [Sampler3] + cue_gotoandplay + 0x90 + 0x0E + + + + + + [Channel2] + MaudioXponent.fx + 0x91 + 0x0E + + + + + + [Sampler2] + cue_gotoandplay + 0x90 + 0x0D + + + + + + [Channel2] + MaudioXponent.fx + 0x91 + 0x0D + + + + + + [Sampler1] + cue_gotoandplay + 0x90 + 0x0C + + + + + + [Channel2] + MaudioXponent.fx + 0x91 + 0x0C + + + + + + [Channel1] + MaudioXponent.volbuttonon + 0x90 + 0x0B + + + + + + [Channel2] + MaudioXponent.volbuttonon + 0x91 + 0x0B + + + + + + [Channel1] + MaudioXponent.actbin + 0x90 + 0x0A + + + + + + [Channel2] + MaudioXponent.actbin + 0x91 + 0x0A + + + + + + [Channel1] + MaudioXponent.actbin + 0x90 + 0x09 + + + + + + [Channel2] + MaudioXponent.actbin + 0x91 + 0x09 + + + + + + [Channel1] + MaudioXponent.actbin + 0x90 + 0x08 + + + + + + [Channel2] + MaudioXponent.actbin + 0x91 + 0x08 + + + + + + [Channel1] + MaudioXponent.punchIn + 0x90 + 0x07 + + + + + + [Channel2] + MaudioXponent.punchIn + 0x91 + 0x07 + + + + + + [Channel1] + beatsync + button + 0x90 + 0x02 + + + + + + [Channel2] + beatsync + button + 0x91 + 0x02 + + + + + + [Channel1] + MaudioXponent.wheel + 0xB0 + 0x16 + + + + + + [Channel2] + MaudioXponent.wheel + 0xB1 + 0x16 + + + + + + [Sampler4] + pregain + 0xB0 + 0x0F + + + + + + [Sampler3] + pregain + 0xB0 + 0x0E + + + + + + [Channel2] + MaudioXponent.fx + 0xB1 + 0x0F + + + + + + [Sampler2] + pregain + 0xB0 + 0x0D + + + + + + [Channel2] + MaudioXponent.fx + 0xB1 + 0x0E + + + + + + [Sampler1] + pregain + 0xB0 + 0x0C + + + + + + [Channel2] + MaudioXponent.fx + 0xB1 + 0x0D + + + + + + [Master] + headMix + fader + 0xB2 + 0x0D + + + + + + [Channel1] + pregain + fader + 0xB0 + 0x0B + + + + + + [Channel2] + MaudioXponent.fx + 0xB1 + 0x0C + + + + + + [Channel2] + pregain + fader + 0xB1 + 0x0B + + + + + + [Channel1] + filterHigh + fader + 0xB0 + 0x0A + + + + + + [Channel2] + filterHigh + fader + 0xB1 + 0x0A + + + + + + [Channel1] + filterMid + fader + 0xB0 + 0x09 + + + + + + [Channel2] + filterMid + fader + 0xB1 + 0x09 + + + + + + [Channel1] + filterLow + fader + 0xB0 + 0x08 + + + + + + [Channel1] + volume + fader + 0xB0 + 0x07 + + + + + + [Channel2] + filterLow + fader + 0xB1 + 0x08 + + + + + + [Channel2] + volume + fader + 0xB1 + 0x07 + + + + + + [Master] + crossfader + fader + 0xB2 + 0x07 + + + + + + [Channel1] + MaudioXponent.pitch + 0xE0 + + + + + + [Channel2] + MaudioXponent.pitch + 0xE1 + + + + + + + + [Channel2] + loop_enabled + 0x91 + 0x2A + 1 + + + [Channel1] + pfl + 0x90 + 0x14 + 1 + + + [Channel2] + filterLowKill + 0x91 + 0x08 + 1 + + + [Channel1] + filterMidKill + 0x90 + 0x09 + 1 + + + [Channel1] + pregain_toggle + 0x90 + 0x0B + 1 + + + [Channel2] + cue_default + 0x91 + 0x23 + 1 + + + [Channel2] + filterHighKill + 0x91 + 0x0A + 1 + + + [Channel2] + back + 0x91 + 0x21 + 1 + + + [Microphone] + talkover + 0x90 + 0x0D + 1 + + + [Channel2] + fwd + 0x91 + 0x22 + 1 + + + [Channel1] + play + 0x90 + 0x24 + 1 + + + [Channel1] + loop_enabled + 0x90 + 0x2A + 1 + + + [Channel2] + pfl + 0x91 + 0x14 + 1 + + + [Channel2] + filterMidKill + 0x91 + 0x09 + 1 + + + [Channel2] + pregain_toggle + 0x91 + 0x0B + 1 + + + [Channel1] + filterLowKill + 0x90 + 0x08 + 1 + + + [Channel1] + cue_default + 0x90 + 0x23 + 1 + + + [Channel1] + back + 0x90 + 0x21 + 1 + + + [Channel1] + fwd + 0x90 + 0x22 + 1 + + + [Channel1] + filterHighKill + 0x90 + 0x0A + 1 + + + [Channel2] + play + 0x91 + 0x24 + 1 + + + + \ No newline at end of file diff --git a/res/controllers/M-Audio-Xponent-Advanced-scripts.js b/res/controllers/M-Audio-Xponent-Advanced-scripts.js new file mode 100644 index 000000000000..66914419d0b2 --- /dev/null +++ b/res/controllers/M-Audio-Xponent-Advanced-scripts.js @@ -0,0 +1,689 @@ +function MaudioXponent () {} + +// ---------- Global variables ---------- +MaudioXponent.id = ""; // The ID for the particular device being controlled for use in debugging, set at init time +MaudioXponent.state = { + deck : [], // Represents everything about an individual deck. + faderPosition : 0, // Temporary storage for cross-fader position during punch-ins. + focusedEffect : 0, + nudgeButtonMode : 0, // 0=normal, 1=reversed + pflMode : 1, // 0=independent, 1=toggle + plnumberpos : 0, + plnumberneg : 0, + syncFlashMode : 1, // 0=off, 1=simple, 2=toggle + vuMeterMode : 0, // 0=channel mode, 1=master mode +}; + +MaudioXponent.leds = { + "play": 0x24, + "cue": 0x23, + "back": 0x21, + "fwd": 0x22, + "in": 0x29, + "out": 0x2B, + "loop": 0x2A, + "loop1": 0x25, + "loop2": 0x26, + "loop4": 0x27, + "loop8": 0x28, + "leftkey": 0x1C, + "rightkey": 0x1D, + "key": 0x1E, + "pluskey": 0x1F, + "minkey": 0x20, + "cue1": 0x17, + "cue2": 0x18, + "cue3": 0x19, + "cue4": 0x1A, + "cue5": 0x1B, + "fx1": 0x0C, + "fx2": 0x0D, + "fx3": 0x0E, + "fx4": 0x0F, + "leftp": 0x10, + "rightp": 0x11, + "bigx": 0x12, + "big-": 0x13, + "head": 0x14, + "scratch": 0x15, + "fadarbutton": 0x07, + "sync": 0x02, + "low": 0x08, + "middle": 0x09, + "hight": 0x0A, + "gain": 0x0B, + "shift": 0x2C +}; + +MaudioXponent.binleds = { + 8: "filterLowKill", + 9: "filterMidKill", + 10: "filterHighKill", + 18: "keylock", + 19: "reverse", + 20: "pfl", + 33: "back", + 34: "fwd", + 36: "play" +}; + +// MaudioXponent.timer = [-1, -1]; // Temporary storage of timer IDs + +MaudioXponent.Handshake1 = [0xF0,0x7E,0x7F,0x06,0x01,0xF7]; +MaudioXponent.Handshake2 = [0xF0,0x00,0x20,0x08,0x00,0x00,0x63,0x0E,0x16,0x40,0x00,0x01,0xF7]; +MaudioXponent.Handshake3 = [0xF0,0x00,0x20,0x08,0x00,0x00,0x63,0x0E,0x16,0x40,0x00,0x00,0xF7]; + +// ---------- Functions ---------- +MaudioXponent.logParams = function(a, b, c, d, e, f) { + print("a="+ a + ", b=" + b + ", c=" + c + ", d=" + d + ", e=" + e + ", f=" + f); +}; + +MaudioXponent.init = function (id) { + MaudioXponent.initDecks(); + MaudioXponent.initLights(); + MaudioXponent.syncLights(); + MaudioXponent.enableSoftTakeover(); +}; + +MaudioXponent.initDecks = function() { + if (MaudioXponent.state.vuMeterMode == 1) { + engine.connectControl("[Master]", "VuMeterL", function(value) { MaudioXponent.volumeLEDs(0, value); }); + engine.connectControl("[Master]", "VuMeterR", function(value) { MaudioXponent.volumeLEDs(1, value); }); + } else { + engine.connectControl("[Channel1]", "VuMeter", function(value) { MaudioXponent.volumeLEDs(0, value); }); + engine.connectControl("[Channel2]", "VuMeter", function(value) { MaudioXponent.volumeLEDs(1, value); }); + } + + var numDecks = engine.getValue("[Master]", "num_decks"); + for (channel = 0; channel < numDecks; channel++) { + var group = "[Channel" + (channel + 1) + "]"; + var deck = MaudioXponent.state.deck[channel] = + { + id : channel + 1, + beatState : false, + group : group, + off : 0x80 + channel, + on : 0x90 + channel, + shift : false, + warnAt : 0, + scratchEnabled : false, + scratching : false, + } + + engine.connectControl(group, "playposition", "MaudioXponent.onPlayPositionChange"); + engine.connectControl(group, "duration", "MaudioXponent.onTrackLoaded"); + engine.connectControl(group, "beat_active", "MaudioXponent.onBeatActive"); + + for (i = 1; i <= 5; i++) { + engine.connectControl(group, "hotcue_" + i + "_enabled", "MaudioXponent.onHotCue"); + } + + engine.connectControl(group, "loop_enabled", "MaudioXponent.onLoopExit"); + engine.connectControl(group, "loop_start_position", "MaudioXponent.onLoopIn"); + engine.connectControl(group, "loop_end_position", "MaudioXponent.onLoopOut"); + for (i = 0.125; i < 16; i *= 2) { + engine.connectControl(group, "beatloop_" + i + "_enabled", "MaudioXponent.onBeatLoop"); + } + + engine.connectControl(group, "keylock", "MaudioXponent.onKeyLock"); + //engine.connectControl(group, "bpm", "MaudioXponent.onBpm"); + } +}; + +MaudioXponent.initLights = function () { + // Enable lights + midi.sendSysexMsg(MaudioXponent.Handshake1, MaudioXponent.Handshake1.length); + midi.sendSysexMsg(MaudioXponent.Handshake2, MaudioXponent.Handshake2.length); + + // This code light on all leds and then light off + midi.sendShortMsg(0xB3, 0x14, 0x00); + midi.sendShortMsg(0xB3, 0x15, 0x00); + + for (var led in MaudioXponent.leds) { + midi.sendShortMsg(MaudioXponent.on, MaudioXponent.leds[led], 0x01); + midi.sendShortMsg(MaudioXponent.on + 1, MaudioXponent.leds[led], 0x01); + MaudioXponent.pauseScript(15); + } + + for(i = 0; i <= 10; i+=1){ + var value = MaudioXponent.convert(i * .1); + // VU meters + midi.sendShortMsg(0xB3, 0x12, value); + midi.sendShortMsg(0xB3, 0x13, value); + + // Progress meters + midi.sendShortMsg(0xB3, 0x14, value); + midi.sendShortMsg(0xB3, 0x15, value); + MaudioXponent.pauseScript(15); + } + + MaudioXponent.pauseScript(500); + + for (var led in MaudioXponent.leds) { + midi.sendShortMsg(MaudioXponent.on, MaudioXponent.leds[led], 0x00); + midi.sendShortMsg(MaudioXponent.on + 1, MaudioXponent.leds[led], 0x00); + MaudioXponent.pauseScript(15); + } + + // VU meters + midi.sendShortMsg(0xB3,0x12,0); + midi.sendShortMsg(0xB3,0x13,0); + + // Progress meters + midi.sendShortMsg(0xB3,0x14,0); + midi.sendShortMsg(0xB3,0x15,0); +}; + +MaudioXponent.syncLights = function() { + var numDecks = engine.getValue("[Master]", "num_decks"); + + for (i = 0; i < numDecks; i++) { + var channel = i + 1; + var group = "[Channel" + channel + "]"; + engine.trigger(group, "keylock"); + engine.trigger(group, "hotcue_1_enabled"); + engine.trigger(group, "hotcue_2_enabled"); + engine.trigger(group, "hotcue_3_enabled"); + engine.trigger(group, "hotcue_4_enabled"); + engine.trigger(group, "hotcue_5_enabled"); + } +}; + +MaudioXponent.enableSoftTakeover = function() { + var numDecks = engine.getValue("[Master]", "num_decks"); + for (i = 0; i < numDecks; i++) { + var channel = i + 1; + var group = "[Channel" + channel + "]"; + engine.softTakeover(group, "rate", true); + } + + // Effects parameters... not working in Mixxx 2.0, should work in 2.1 + for(i = 1; i < 5; i++) { + engine.softTakeover("[EffectRack1_EffectUnit" + i + "_Effect1]", "parameter1", true); + engine.softTakeover("[EffectRack1_EffectUnit" + i + "_Effect1]", "parameter2", true); + engine.softTakeover("[EffectRack1_EffectUnit" + i + "_Effect1]", "parameter3", true); + engine.softTakeover("[EffectRack1_EffectUnit" + i + "]", "mix", true); + } +}; + +MaudioXponent.convert = function(value) { + value = value * 127; + value = value.toFixed(0); + return (value); +}; + +MaudioXponent.getChannel = function(group) { + return parseInt(group.substring(8)) - 1; +}; + +MaudioXponent.pauseScript = function(ms) { + startDate = new Date(); + currentDate = null; + while(currentDate-startDate < ms) currentDate = new Date(); +}; + +MaudioXponent.wheel = function (channel, control, value, status, group) { + var deck = MaudioXponent.state.deck[channel]; + + if (deck.shift) { + if (value > 64) { + MaudioXponent.state["plnumberpos"]++; + if (MaudioXponent.state["plnumberpos"] % 12 == 0) { + engine.setValue("[Playlist]", "SelectTrackKnob",1); + } + } else if (value < 64) { + MaudioXponent.state["plnumberneg"]++; + if (MaudioXponent.state["plnumberneg"] % 12 == 0) { + engine.setValue("[Playlist]", "SelectTrackKnob",-1); + } + } + } else { + if (deck.scratching) { + engine.scratchTick(deck.id, value-64); + } else { + engine.setValue(group, "jog", (value-64)/8); + } + } +}; + +MaudioXponent.wheelTouch = function(channel, control, value, status) { + //script.midiDebug(channel, control, value, status) + var deck = MaudioXponent.state.deck[channel]; + var activate = (status == deck.on); + + if (activate) { + if (deck.scratchEnabled) { + engine.scratchEnable(deck.id, 3*128, 33+1/3, 1.0/8, (1.0/8)/32); + deck.scratching = true; + } + } else { + engine.scratchDisable (deck.id); + deck.scratching = false; + } +} + +MaudioXponent.onBeatActive = function(value, group) { + var channel = MaudioXponent.getChannel(group); + var deck = MaudioXponent.state.deck[channel]; + + if (MaudioXponent.state.syncFlashMode === 1) { + midi.sendShortMsg(deck.on, 0x02, value); + } + + if (value) { + deck.beatState = !deck.beatState; + + if (MaudioXponent.state.syncFlashMode === 2) { + midi.sendShortMsg(deck.on, 0x02, deck.beatState); + } + } +}; + +MaudioXponent.onBeatLoop = function(value, group, control) { + var channel = MaudioXponent.getChannel(group); + var deck = MaudioXponent.state.deck[channel]; + var offset = Math.log(parseInt(control.substring(9))) / Math.log(2) + + midi.sendShortMsg(deck.on, MaudioXponent.leds.loop1 + offset, value); +} + +MaudioXponent.onBpm = function(value, group) { + print ("BPM Change, " + group + ", value=" + value); +}; + +MaudioXponent.onPlayPositionChange = function(value, group) { + var channel = MaudioXponent.getChannel(group); + var deck = MaudioXponent.state.deck[channel]; + + if (deck) { + if ((value < deck.warnAt) || (value >= deck.warnAt && deck.beatState)) { + midi.sendShortMsg(0xB3, 0x14 + channel, MaudioXponent.convert(value)); + } else { + midi.sendShortMsg(0xB3, 0x14 + channel, 0x00); + } + } +}; + +MaudioXponent.volumeLEDs = function(channel, value) { + midi.sendShortMsg(0xB3,0x12 + channel, MaudioXponent.convert(value)); +}; + +MaudioXponent.actbin = function(channel, control, value, status) { + //script.midiDebug(channel, control, value, status); + var deck = MaudioXponent.state.deck[channel]; + var activenow = engine.getValue(deck.group, MaudioXponent.binleds[control]); + + if (activenow) { + print("activenow: group=" + deck.group + ", control=" + MaudioXponent.binleds[control] + ", value=0"); + engine.setValue(deck.group, MaudioXponent.binleds[control], 0); + midi.sendShortMsg(deck.off, control, 0x00); + } else { + print("activenow: group=" + deck.group + ", control=" + MaudioXponent.binleds[control] + ", value=1"); + engine.setValue(deck.group, MaudioXponent.binleds[control], 1); + midi.sendShortMsg(deck.on, control, 0x01); + } +}; + +MaudioXponent.actbinstop = function(channel, control, value, status) { + //script.midiDebug(channel, control, value, status); + var deck = MaudioXponent.state.deck[channel]; + engine.setValue(deck.group, MaudioXponent.binleds[control], 0); + midi.sendShortMsg(deck.off,control,0x00); +}; + +MaudioXponent.onHotCue = function(value, group, control) { + var channel = MaudioXponent.getChannel(group); + var deck = MaudioXponent.state.deck[channel]; + var cueNumber = parseInt(control.substring(7)) - 1; + midi.sendShortMsg(deck.on, MaudioXponent.leds.cue1 + cueNumber, value); +} + +MaudioXponent.hotcue = function(channel, control, value, status, group) { + //script.midiDebug(channel, control, value, status, group) + var deck = MaudioXponent.state.deck[channel]; + var cueNumber = control - 0x16; + + if (!deck.shift) { + var activate = (status == deck.on); + engine.setValue(group, "hotcue_" + cueNumber + "_activate", activate); + } else { + engine.setValue(group, "hotcue_" + cueNumber + "_clear", 1); + } +}; + +MaudioXponent.onLoopIn = function(value, group, control) +{ + var channel = MaudioXponent.getChannel(group); + var deck = MaudioXponent.state.deck[channel]; + midi.sendShortMsg(deck.on, 0x29, engine.getValue(group, control) != -1); +} + +MaudioXponent.onLoopOut = function(value, group, control) +{ + var channel = MaudioXponent.getChannel(group); + var deck = MaudioXponent.state.deck[channel]; + midi.sendShortMsg(deck.on, 0x2B, engine.getValue(group, control) != -1); +} + +MaudioXponent.onLoopExit = function(value, group, control) +{ + var channel = MaudioXponent.getChannel(group); + var deck = MaudioXponent.state.deck[channel]; + midi.sendShortMsg(deck.on, 0x2A, engine.getValue(group, control) == 1); +} + +MaudioXponent.loopin = function(channel, control, value, status) { + var deck = MaudioXponent.state.deck[channel]; + engine.setValue(deck.group, "loop_in", 1); +}; + +MaudioXponent.loopout = function(channel, control, value, status) { + // TODO: Can we use the channel passed in? + var deck = MaudioXponent.state.deck[channel]; + engine.setValue(deck.group, "loop_out", 1); +}; + +MaudioXponent.loopexit = function(channel, control, value, status) { + // TODO: Can we use the channel passed in? + var deck = MaudioXponent.state.deck[channel]; + engine.setValue(deck.group, "reloop_exit", 1); +}; + +MaudioXponent.punchIn = function(channel, control, value, status) { + // TODO: Can we use the channel passed in? + var deck = MaudioXponent.state.deck[channel]; + var activate = (status == deck.on); + + if (activate) { + MaudioXponent.state.faderPosition = faderPosition = engine.getValue("[Master]", "crossfader"); + + if ((faderPosition >= 0.90 && channel == 0) || (faderPosition <= -0.90 && channel == 1)) { + midi.sendShortMsg(deck.on,control,0x01); + engine.setValue("[Master]", "crossfader", 0); + } + } else { + engine.setValue("[Master]", "crossfader", MaudioXponent.state.faderPosition); + midi.sendShortMsg(deck.on, control, 0x00); + } +}; + +MaudioXponent.pitch = function(channel, control, value, status, group) { + engine.setValue(group, "rate", script.midiPitch(control, value, status)); +}; + +MaudioXponent.secondaryon = function(channel, control, value, status) { + // TODO: Can we use the channel passed in? + var deck = MaudioXponent.state.deck[channel]; + deck.shift = true; + midi.sendShortMsg(deck.on, control, 0x01); +}; + +MaudioXponent.secondaryoff = function(channel, control, value, status) { + // TODO: Can we use the channel passed in? + var deck = MaudioXponent.state.deck[channel]; + deck.shift = false; + midi.sendShortMsg(deck.on,control,0x00); +}; + +MaudioXponent.toggleScratchMode = function(channel, control, value, status) { + script.midiDebug(channel, control, value, status); + var deck = MaudioXponent.state.deck[channel]; + + deck.scratchEnabled = !deck.scratchEnabled; + midi.sendShortMsg(deck.on, control, deck.scratchEnabled); +}; + +MaudioXponent.playlist = function(channel, control, value, status) { + var deck = MaudioXponent.state.deck[channel]; + switch (control) { + case 28: + midi.sendShortMsg(deck.on,control,0x01); // Turn on the LED + engine.setValue("[Playlist]", "SelectPrevTrack",1); + break; + case 29: + midi.sendShortMsg(deck.on,control,0x01); // Turn on the LED + engine.setValue("[Playlist]", "SelectNextTrack",1); + break; + case 30: + midi.sendShortMsg(deck.on,control,0x01); // Turn on the LED + var activenow = engine.getValue(deck.group, "play"); + if (activenow == 1) { // If currently active + engine.setValue("[Playlist]", "LoadSelectedIntoFirstStopped",1); + }else{ + engine.setValue(deck.group, "LoadSelectedTrack",1); + } + break; + case 31: + midi.sendShortMsg(deck.on,control,0x01); // Turn on the LED + engine.setValue("[Playlist]", "SelectPrevPlaylist",1); + break; + case 32: + midi.sendShortMsg(deck.on,control,0x01); // Turn on the LED + engine.setValue("[Playlist]", "SelectNextPlaylist",1); + break; + } +}; + +MaudioXponent.playlistoff = function(channel, control, value, status) { + var deck = MaudioXponent.state.deck[channel]; + midi.sendShortMsg(deck.off, control, 0x00); +}; + +MaudioXponent.onKeyLock = function(value, group) { + var channel = MaudioXponent.getChannel(group); + var deck = MaudioXponent.state.deck[channel]; + + if (value) { + midi.sendShortMsg(deck.on, 0x1E, 0x01) + } else { + midi.sendShortMsg(deck.off, 0x1E, 0x00) + } +}; + +MaudioXponent.toggleKeylock = function(channel, control, value, status) { + //script.midiDebug(channel, control, value, status); + var deck = MaudioXponent.state.deck[channel]; + + if (!deck.shift) { + // Unshifted = Keylock + var currentValue = engine.getParameter(deck.group, "keylock"); + if (currentValue == 0){ + engine.setValue(deck.group,"keylock",0x01); + } else { + engine.setValue(deck.group,"keylock", 0x00); + } + }else{ + // Shifted = Quantize + var currentValue = engine.getParameter(deck.group, "quantize"); + if (currentValue == 0){ + engine.setValue(deck.group,"quantize",0x01); + } else { + engine.setValue(deck.group,"quantize", 0x00); + } + } +}; + +MaudioXponent.brake = function(channel, control, value, status) { + //script.midiDebug(channel, control, value, status); + var deck = MaudioXponent.state.deck[channel]; + var activate = (status == deck.on); + + if (activate) { + engine.brake(deck.id, true); + } else { + engine.brake(deck.id, false) + } +}; + +MaudioXponent.cuedefon = function(channel, control, value, status) { + //script.midiDebug(channel, control, value, status); + var deck = MaudioXponent.state.deck[channel]; + engine.setValue(deck.group, "cue_default",1); + midi.sendShortMsg(deck.on, control, 0x01); +}; + +MaudioXponent.cuedefoff = function(channel, control, value, status) { + //script.midiDebug(channel, control, value, status); + var deck = MaudioXponent.state.deck[channel]; + engine.setValue(deck.group, "cue_default",0); + midi.sendShortMsg(deck.off, control, 0x00); +}; + +MaudioXponent.volbuttonon = function(channel, control, value, status) { + //script.midiDebug(channel, control, value, status); + var deck = MaudioXponent.state.deck[channel]; + engine.setValue(deck.group, "volume",0); + midi.sendShortMsg(deck.on,control,0x01); +}; + +MaudioXponent.volbuttonoff = function(channel, control, value, status) { + //script.midiDebug(channel, control, value, status); + var deck = MaudioXponent.state.deck[channel]; + engine.setValue(deck.group, "volume",1); + midi.sendShortMsg(deck.off, control, 0x00); +}; + +MaudioXponent.shutdown = function (id) { // called when the MIDI device is closed + // TODO: How does 4-deck mode affect this? + for (var led in MaudioXponent.leds) { + midi.sendShortMsg(MaudioXponent.on,MaudioXponent.leds[led],0x00); + midi.sendShortMsg(MaudioXponent.on + 1,MaudioXponent.leds[led],0x00); + } + midi.sendShortMsg(0xB3,0x14,0x00); + midi.sendShortMsg(0xB3,0x15,0x00); + + midi.sendSysexMsg(MaudioXponent.Handshake3, MaudioXponent.Handshake3.length); +}; + +MaudioXponent.beatgridAdjust = function(channel, control, value, status) { + //script.midiDebug(channel, control, value, status); + var deck = MaudioXponent.state.deck[channel]; + + if (!deck.shift) { + // Unshifted = earlier / later + if (control == MaudioXponent.leds.leftkey){ + engine.setValue(deck.group, "beats_translate_earlier", 1); + } else { + engine.setValue(deck.group, "beats_translate_later", 1); + } + } else { + // Shifted = align + engine.setValue(deck.group, "beats_translate_curpos", 1); + } +}; + +MaudioXponent.beatgridLoop = function(channel, control, value, status, group) { + //script.midiDebug(channel, control, value, status, group); + var deck = MaudioXponent.state.deck[channel]; + var activate = (status == deck.on); + var length = Math.pow(2, control - 0x25); + + if (!deck.shift) { + if (activate) { + engine.setValue(group, "beatloop_" + length + "_toggle", value); + } + } else { + if (activate) { + engine.setValue(group, "beatlooproll_" + 1.0 / length + "_activate", value); + } else { + //print ("Exit rolling beat loop"); + MaudioXponent.loopexit(channel, control, value, status) + } + } +}; + +MaudioXponent.beatsync = function(channel, control, value, status) { + //script.midiDebug(channel, control, value, status); + var deck = MaudioXponent.state.deck[channel]; + + if (!deck.shift) { + engine.setValue(deck.group, "beatsync", 1); + } else { + engine.setValue(deck.group, "bpm_tap", 1); + } +}; + +MaudioXponent.fx = function(channel, control, value, status) { + //script.midiDebug(channel, control, value, status); + var deck = MaudioXponent.state.deck[channel]; + var currentControl = control - 0x0B; + var isKnob = (status == 0xB1); + + if (isKnob) { + var group = "[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffect + "_Effect1]"; + var scaledValue = value / 0x7F; + + if (currentControl == 4) { + // Wet / Dry + //print("Group " + group + ", parameter = " + currentControl + ", value = " + scaledValue); + engine.setParameter("[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffect + "]", "mix", scaledValue); + } else { + // Other parameter + //print("Group " + group + ", parameter = " + currentControl + ", value = " + scaledValue); + engine.setParameter(group, "parameter" + currentControl, scaledValue); + } + } else { + var group = "[EffectRack1_EffectUnit" + currentControl + "]"; + // print("Button " + group + ", MaudioXponent.state.focusedEffect=" + MaudioXponent.state.focusedEffect); + + if (deck.shift) { + // Cycle effects + engine.setValue(group, "next_chain", 1); + } else { + if (currentControl == MaudioXponent.state.focusedEffect) { + // Toggle enabled + var effectEnabled = engine.getValue(group, "enabled"); + if (effectEnabled) { + engine.setValue(group, "enabled", 0); + } else { + engine.setValue(group, "enabled", 1); + } + } else { + // Change focus + MaudioXponent.state.focusedEffect = currentControl; + } + + // Light the focused effect + for(i = 0; i < 4; i++) { + var ctrl = MaudioXponent.leds.fx1 + i; + var fxNum = i + 1; + var newValue = (fxNum == MaudioXponent.state.focusedEffect) ? 1 : 0; + + //print("fxNum = " + fxNum + ", channel = " + channel + ", ctrl = 0x0" + ctrl.toString(16) + ", newValue = " + newValue); + midi.sendShortMsg(deck.on, ctrl, newValue); + } + } + } +}; + +MaudioXponent.onTrackLoaded = function(duration, group) { + var channel = MaudioXponent.getChannel(group); + var deck = MaudioXponent.state.deck[channel]; + deck.warnAt = (duration - 30) / parseFloat(duration); +}; + +MaudioXponent.nudge = function (channel, control, value, status, group) { + //script.midiDebug(channel, control, value, status, group); + var deck = MaudioXponent.state.deck[channel]; + var controlName = ((control == 0x10 && MaudioXponent.state.nudgeButtonMode == 0) || (control != 0x10 && MaudioXponent.state.nudgeButtonMode == 1)) + ? "rate_temp_down" + : "rate_temp_up"; + var activate = (status == deck.on); + engine.setValue(group, controlName, activate); +}; + +MaudioXponent.pfl = function(channel, control, value, status) { + //script.midiDebug(channel, control, value, status); + var numDecks = engine.getValue("[Master]", "num_decks"); + + for (i = 1; i <= numDecks; i++) { + var group = "[Channel" + i + "]"; + var currentValue = engine.getValue(group, "pfl"); + + if (i == channel + 1) { + engine.setValue(group, "pfl", !currentValue); + } else if (MaudioXponent.state.pflMode == 1) { + engine.setValue(group, "pfl", 0); + } + } +} \ No newline at end of file From 6ee6a366d9e288ed12b9436dadb6007608e24b5f Mon Sep 17 00:00:00 2001 From: Mel Grubb Date: Wed, 15 Feb 2017 12:50:21 -0500 Subject: [PATCH 02/20] Refactoring and cleanup. Eliminating repetition. --- .../M-Audio-Xponent-Advanced-scripts.js | 109 ++++++++---------- 1 file changed, 46 insertions(+), 63 deletions(-) diff --git a/res/controllers/M-Audio-Xponent-Advanced-scripts.js b/res/controllers/M-Audio-Xponent-Advanced-scripts.js index 66914419d0b2..48d1b9f40e44 100644 --- a/res/controllers/M-Audio-Xponent-Advanced-scripts.js +++ b/res/controllers/M-Audio-Xponent-Advanced-scripts.js @@ -2,16 +2,21 @@ function MaudioXponent () {} // ---------- Global variables ---------- MaudioXponent.id = ""; // The ID for the particular device being controlled for use in debugging, set at init time + +MaudioXponent.config = { + nudgeButtonMode : 0, // 0 = Normal, 1 = Reversed + pflMode : 1, // 0 = Independent, 1 = Toggle + syncFlashMode : 0, // 0 = Off, 1 = Simple, 2 = Toggle + vuMeterMode : 0, // 0 = Per-Channel mode, 1 = Master Mode +} + MaudioXponent.state = { - deck : [], // Represents everything about an individual deck. + deck : [], // Stores everything about an individual deck faderPosition : 0, // Temporary storage for cross-fader position during punch-ins. focusedEffect : 0, - nudgeButtonMode : 0, // 0=normal, 1=reversed - pflMode : 1, // 0=independent, 1=toggle + numDecks : 0, plnumberpos : 0, plnumberneg : 0, - syncFlashMode : 1, // 0=off, 1=simple, 2=toggle - vuMeterMode : 0, // 0=channel mode, 1=master mode }; MaudioXponent.leds = { @@ -67,8 +72,6 @@ MaudioXponent.binleds = { 36: "play" }; -// MaudioXponent.timer = [-1, -1]; // Temporary storage of timer IDs - MaudioXponent.Handshake1 = [0xF0,0x7E,0x7F,0x06,0x01,0xF7]; MaudioXponent.Handshake2 = [0xF0,0x00,0x20,0x08,0x00,0x00,0x63,0x0E,0x16,0x40,0x00,0x01,0xF7]; MaudioXponent.Handshake3 = [0xF0,0x00,0x20,0x08,0x00,0x00,0x63,0x0E,0x16,0x40,0x00,0x00,0xF7]; @@ -79,6 +82,8 @@ MaudioXponent.logParams = function(a, b, c, d, e, f) { }; MaudioXponent.init = function (id) { + MaudioXponent.state.numDecks = engine.getValue("[Master]", "num_decks"); + MaudioXponent.initDecks(); MaudioXponent.initLights(); MaudioXponent.syncLights(); @@ -86,7 +91,7 @@ MaudioXponent.init = function (id) { }; MaudioXponent.initDecks = function() { - if (MaudioXponent.state.vuMeterMode == 1) { + if (MaudioXponent.config.vuMeterMode == 1) { engine.connectControl("[Master]", "VuMeterL", function(value) { MaudioXponent.volumeLEDs(0, value); }); engine.connectControl("[Master]", "VuMeterR", function(value) { MaudioXponent.volumeLEDs(1, value); }); } else { @@ -94,15 +99,14 @@ MaudioXponent.initDecks = function() { engine.connectControl("[Channel2]", "VuMeter", function(value) { MaudioXponent.volumeLEDs(1, value); }); } - var numDecks = engine.getValue("[Master]", "num_decks"); - for (channel = 0; channel < numDecks; channel++) { + for (channel = 0; channel < MaudioXponent.state.numDecks; channel++) { var group = "[Channel" + (channel + 1) + "]"; var deck = MaudioXponent.state.deck[channel] = { id : channel + 1, beatState : false, group : group, - off : 0x80 + channel, + off : 0x80 + channel + (channel >= 3 ? 5 : 0), on : 0x90 + channel, shift : false, warnAt : 0, @@ -126,8 +130,18 @@ MaudioXponent.initDecks = function() { } engine.connectControl(group, "keylock", "MaudioXponent.onKeyLock"); - //engine.connectControl(group, "bpm", "MaudioXponent.onBpm"); + engine.connectControl(group, "bpm", "MaudioXponent.onBpmChanged"); + + engine.softTakeover(group, "rate", true); } + + // Effects parameters... not working in Mixxx 2.0, should work in 2.1 + for(i = 1; i < 5; i++) { + engine.softTakeover("[EffectRack1_EffectUnit" + i + "_Effect1]", "parameter1", true); + engine.softTakeover("[EffectRack1_EffectUnit" + i + "_Effect1]", "parameter2", true); + engine.softTakeover("[EffectRack1_EffectUnit" + i + "_Effect1]", "parameter3", true); + engine.softTakeover("[EffectRack1_EffectUnit" + i + "]", "mix", true); + } }; MaudioXponent.initLights = function () { @@ -175,9 +189,7 @@ MaudioXponent.initLights = function () { }; MaudioXponent.syncLights = function() { - var numDecks = engine.getValue("[Master]", "num_decks"); - - for (i = 0; i < numDecks; i++) { + for (i = 0; i < MaudioXponent.state.numDecks; i++) { var channel = i + 1; var group = "[Channel" + channel + "]"; engine.trigger(group, "keylock"); @@ -189,31 +201,12 @@ MaudioXponent.syncLights = function() { } }; -MaudioXponent.enableSoftTakeover = function() { - var numDecks = engine.getValue("[Master]", "num_decks"); - for (i = 0; i < numDecks; i++) { - var channel = i + 1; - var group = "[Channel" + channel + "]"; - engine.softTakeover(group, "rate", true); - } - - // Effects parameters... not working in Mixxx 2.0, should work in 2.1 - for(i = 1; i < 5; i++) { - engine.softTakeover("[EffectRack1_EffectUnit" + i + "_Effect1]", "parameter1", true); - engine.softTakeover("[EffectRack1_EffectUnit" + i + "_Effect1]", "parameter2", true); - engine.softTakeover("[EffectRack1_EffectUnit" + i + "_Effect1]", "parameter3", true); - engine.softTakeover("[EffectRack1_EffectUnit" + i + "]", "mix", true); - } -}; - MaudioXponent.convert = function(value) { - value = value * 127; - value = value.toFixed(0); - return (value); + return (value * 127).toFixed(0); }; -MaudioXponent.getChannel = function(group) { - return parseInt(group.substring(8)) - 1; +MaudioXponent.getDeck = function(group) { + var deck = MaudioXponent.state.deck[parseInt(group.substring(8)) - 1]; }; MaudioXponent.pauseScript = function(ms) { @@ -263,37 +256,34 @@ MaudioXponent.wheelTouch = function(channel, control, value, status) { } MaudioXponent.onBeatActive = function(value, group) { - var channel = MaudioXponent.getChannel(group); - var deck = MaudioXponent.state.deck[channel]; + var deck = MaudioXponent.getDeck[group]; - if (MaudioXponent.state.syncFlashMode === 1) { + if (MaudioXponent.config.syncFlashMode === 1) { midi.sendShortMsg(deck.on, 0x02, value); } if (value) { deck.beatState = !deck.beatState; - if (MaudioXponent.state.syncFlashMode === 2) { + if (MaudioXponent.config.syncFlashMode === 2) { midi.sendShortMsg(deck.on, 0x02, deck.beatState); } } }; MaudioXponent.onBeatLoop = function(value, group, control) { - var channel = MaudioXponent.getChannel(group); - var deck = MaudioXponent.state.deck[channel]; + var deck = MaudioXponent.getDeck[group]; var offset = Math.log(parseInt(control.substring(9))) / Math.log(2) midi.sendShortMsg(deck.on, MaudioXponent.leds.loop1 + offset, value); } -MaudioXponent.onBpm = function(value, group) { - print ("BPM Change, " + group + ", value=" + value); +MaudioXponent.onBpmChanged = function(value, group) { + //print ("BPM Change, " + group + ", value=" + value); }; MaudioXponent.onPlayPositionChange = function(value, group) { - var channel = MaudioXponent.getChannel(group); - var deck = MaudioXponent.state.deck[channel]; + var deck = MaudioXponent.getDeck[group]; if (deck) { if ((value < deck.warnAt) || (value >= deck.warnAt && deck.beatState)) { @@ -332,8 +322,7 @@ MaudioXponent.actbinstop = function(channel, control, value, status) { }; MaudioXponent.onHotCue = function(value, group, control) { - var channel = MaudioXponent.getChannel(group); - var deck = MaudioXponent.state.deck[channel]; + var deck = MaudioXponent.getDeck[group]; var cueNumber = parseInt(control.substring(7)) - 1; midi.sendShortMsg(deck.on, MaudioXponent.leds.cue1 + cueNumber, value); } @@ -351,24 +340,20 @@ MaudioXponent.hotcue = function(channel, control, value, status, group) { } }; -MaudioXponent.onLoopIn = function(value, group, control) -{ - var channel = MaudioXponent.getChannel(group); - var deck = MaudioXponent.state.deck[channel]; +MaudioXponent.onLoopIn = function(value, group, control){ + var deck = MaudioXponent.getDeck[group]; midi.sendShortMsg(deck.on, 0x29, engine.getValue(group, control) != -1); } MaudioXponent.onLoopOut = function(value, group, control) { - var channel = MaudioXponent.getChannel(group); - var deck = MaudioXponent.state.deck[channel]; + var deck = MaudioXponent.getDeck[group]; midi.sendShortMsg(deck.on, 0x2B, engine.getValue(group, control) != -1); } MaudioXponent.onLoopExit = function(value, group, control) { - var channel = MaudioXponent.getChannel(group); - var deck = MaudioXponent.state.deck[channel]; + var deck = MaudioXponent.getDeck[group]; midi.sendShortMsg(deck.on, 0x2A, engine.getValue(group, control) == 1); } @@ -470,8 +455,7 @@ MaudioXponent.playlistoff = function(channel, control, value, status) { }; MaudioXponent.onKeyLock = function(value, group) { - var channel = MaudioXponent.getChannel(group); - var deck = MaudioXponent.state.deck[channel]; + var deck = MaudioXponent.getDeck[group]; if (value) { midi.sendShortMsg(deck.on, 0x1E, 0x01) @@ -657,15 +641,14 @@ MaudioXponent.fx = function(channel, control, value, status) { }; MaudioXponent.onTrackLoaded = function(duration, group) { - var channel = MaudioXponent.getChannel(group); - var deck = MaudioXponent.state.deck[channel]; + var deck = MaudioXponent.getDeck[group]; deck.warnAt = (duration - 30) / parseFloat(duration); }; MaudioXponent.nudge = function (channel, control, value, status, group) { //script.midiDebug(channel, control, value, status, group); var deck = MaudioXponent.state.deck[channel]; - var controlName = ((control == 0x10 && MaudioXponent.state.nudgeButtonMode == 0) || (control != 0x10 && MaudioXponent.state.nudgeButtonMode == 1)) + var controlName = ((control == 0x10 && MaudioXponent.config.nudgeButtonMode == 0) || (control != 0x10 && MaudioXponent.config.nudgeButtonMode == 1)) ? "rate_temp_down" : "rate_temp_up"; var activate = (status == deck.on); @@ -682,7 +665,7 @@ MaudioXponent.pfl = function(channel, control, value, status) { if (i == channel + 1) { engine.setValue(group, "pfl", !currentValue); - } else if (MaudioXponent.state.pflMode == 1) { + } else if (MaudioXponent.config.pflMode == 1) { engine.setValue(group, "pfl", 0); } } From f051a35c15866e3d74bfba93d21cf9762e424699 Mon Sep 17 00:00:00 2001 From: Mel Grubb Date: Fri, 17 Feb 2017 12:21:32 -0500 Subject: [PATCH 03/20] Refactoring and cleanup --- .../M-Audio Xponent (Advanced).midi.xml | 17 ++-- .../M-Audio-Xponent-Advanced-scripts.js | 82 ++++++++++--------- 2 files changed, 51 insertions(+), 48 deletions(-) diff --git a/res/controllers/M-Audio Xponent (Advanced).midi.xml b/res/controllers/M-Audio Xponent (Advanced).midi.xml index b72e4d2dd2c6..7e9423272f61 100644 --- a/res/controllers/M-Audio Xponent (Advanced).midi.xml +++ b/res/controllers/M-Audio Xponent (Advanced).midi.xml @@ -8,7 +8,7 @@ Includes Samplers, Effects, Loops, Hotcues, and more. See Wiki for details. Make sure to set the bank switch on the bottom of the Xponent to A. - http://www.mixxx.org/forums/viewtopic.php?f=7&t=8884 + http://www.mixxx.org/forums/viewtopic.php?t=8884 http://www.mixxx.org/wiki/doku.php/m-audio_xponent @@ -1476,6 +1476,13 @@ + + [Channel1] + loop_enabled + 0x90 + 0x2A + 1 + [Channel2] loop_enabled @@ -1483,6 +1490,7 @@ 0x2A 1 + [Channel1] pfl @@ -1553,13 +1561,6 @@ 0x24 1 - - [Channel1] - loop_enabled - 0x90 - 0x2A - 1 - [Channel2] pfl diff --git a/res/controllers/M-Audio-Xponent-Advanced-scripts.js b/res/controllers/M-Audio-Xponent-Advanced-scripts.js index 48d1b9f40e44..0e1d9f17f993 100644 --- a/res/controllers/M-Audio-Xponent-Advanced-scripts.js +++ b/res/controllers/M-Audio-Xponent-Advanced-scripts.js @@ -2,6 +2,8 @@ function MaudioXponent () {} // ---------- Global variables ---------- MaudioXponent.id = ""; // The ID for the particular device being controlled for use in debugging, set at init time +MaudioXponent.on = 0x90; +MaudioXponent.off = 0x80; MaudioXponent.config = { nudgeButtonMode : 0, // 0 = Normal, 1 = Reversed @@ -87,7 +89,6 @@ MaudioXponent.init = function (id) { MaudioXponent.initDecks(); MaudioXponent.initLights(); MaudioXponent.syncLights(); - MaudioXponent.enableSoftTakeover(); }; MaudioXponent.initDecks = function() { @@ -99,20 +100,22 @@ MaudioXponent.initDecks = function() { engine.connectControl("[Channel2]", "VuMeter", function(value) { MaudioXponent.volumeLEDs(1, value); }); } - for (channel = 0; channel < MaudioXponent.state.numDecks; channel++) { - var group = "[Channel" + (channel + 1) + "]"; - var deck = MaudioXponent.state.deck[channel] = - { - id : channel + 1, + for (index = 0; index < MaudioXponent.state.numDecks; index++) { + var channel = index + 1; + var group = "[Channel" + (channel) + "]"; + var offset = index == 0 ? 0 : index == 1 ? 1 : index == 2 ? 5 : index == 3 ? 6 : 0; + + MaudioXponent.state.deck[index] = { + id : channel, beatState : false, group : group, - off : 0x80 + channel + (channel >= 3 ? 5 : 0), - on : 0x90 + channel, + off : 0x80 + offset, + on : 0x90 + offset, shift : false, warnAt : 0, scratchEnabled : false, scratching : false, - } + }; engine.connectControl(group, "playposition", "MaudioXponent.onPlayPositionChange"); engine.connectControl(group, "duration", "MaudioXponent.onTrackLoaded"); @@ -136,7 +139,7 @@ MaudioXponent.initDecks = function() { } // Effects parameters... not working in Mixxx 2.0, should work in 2.1 - for(i = 1; i < 5; i++) { + for(i = 1; i <= 4; i++) { engine.softTakeover("[EffectRack1_EffectUnit" + i + "_Effect1]", "parameter1", true); engine.softTakeover("[EffectRack1_EffectUnit" + i + "_Effect1]", "parameter2", true); engine.softTakeover("[EffectRack1_EffectUnit" + i + "_Effect1]", "parameter3", true); @@ -206,7 +209,7 @@ MaudioXponent.convert = function(value) { }; MaudioXponent.getDeck = function(group) { - var deck = MaudioXponent.state.deck[parseInt(group.substring(8)) - 1]; + return MaudioXponent.state.deck[parseInt(group.substring(8)) - 1]; }; MaudioXponent.pauseScript = function(ms) { @@ -256,7 +259,7 @@ MaudioXponent.wheelTouch = function(channel, control, value, status) { } MaudioXponent.onBeatActive = function(value, group) { - var deck = MaudioXponent.getDeck[group]; + var deck = MaudioXponent.getDeck(group); if (MaudioXponent.config.syncFlashMode === 1) { midi.sendShortMsg(deck.on, 0x02, value); @@ -272,7 +275,7 @@ MaudioXponent.onBeatActive = function(value, group) { }; MaudioXponent.onBeatLoop = function(value, group, control) { - var deck = MaudioXponent.getDeck[group]; + var deck = MaudioXponent.getDeck(group); var offset = Math.log(parseInt(control.substring(9))) / Math.log(2) midi.sendShortMsg(deck.on, MaudioXponent.leds.loop1 + offset, value); @@ -283,14 +286,11 @@ MaudioXponent.onBpmChanged = function(value, group) { }; MaudioXponent.onPlayPositionChange = function(value, group) { - var deck = MaudioXponent.getDeck[group]; - - if (deck) { - if ((value < deck.warnAt) || (value >= deck.warnAt && deck.beatState)) { - midi.sendShortMsg(0xB3, 0x14 + channel, MaudioXponent.convert(value)); - } else { - midi.sendShortMsg(0xB3, 0x14 + channel, 0x00); - } + var deck = MaudioXponent.getDeck(group); + if ((value < deck.warnAt) || (!engine.getValue(group, "play")) || (value >= deck.warnAt && deck.beatState)) { + midi.sendShortMsg(0xB3, 0x13 + deck.id, MaudioXponent.convert(value)); + } else { + midi.sendShortMsg(0xB3, 0x13 + deck.id, 0x00); } }; @@ -322,7 +322,7 @@ MaudioXponent.actbinstop = function(channel, control, value, status) { }; MaudioXponent.onHotCue = function(value, group, control) { - var deck = MaudioXponent.getDeck[group]; + var deck = MaudioXponent.getDeck(group); var cueNumber = parseInt(control.substring(7)) - 1; midi.sendShortMsg(deck.on, MaudioXponent.leds.cue1 + cueNumber, value); } @@ -341,19 +341,19 @@ MaudioXponent.hotcue = function(channel, control, value, status, group) { }; MaudioXponent.onLoopIn = function(value, group, control){ - var deck = MaudioXponent.getDeck[group]; + var deck = MaudioXponent.getDeck(group); midi.sendShortMsg(deck.on, 0x29, engine.getValue(group, control) != -1); } MaudioXponent.onLoopOut = function(value, group, control) { - var deck = MaudioXponent.getDeck[group]; + var deck = MaudioXponent.getDeck(group); midi.sendShortMsg(deck.on, 0x2B, engine.getValue(group, control) != -1); } MaudioXponent.onLoopExit = function(value, group, control) { - var deck = MaudioXponent.getDeck[group]; + var deck = MaudioXponent.getDeck(group); midi.sendShortMsg(deck.on, 0x2A, engine.getValue(group, control) == 1); } @@ -455,7 +455,7 @@ MaudioXponent.playlistoff = function(channel, control, value, status) { }; MaudioXponent.onKeyLock = function(value, group) { - var deck = MaudioXponent.getDeck[group]; + var deck = MaudioXponent.getDeck(group); if (value) { midi.sendShortMsg(deck.on, 0x1E, 0x01) @@ -594,17 +594,19 @@ MaudioXponent.fx = function(channel, control, value, status) { var isKnob = (status == 0xB1); if (isKnob) { - var group = "[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffect + "_Effect1]"; - var scaledValue = value / 0x7F; - - if (currentControl == 4) { - // Wet / Dry - //print("Group " + group + ", parameter = " + currentControl + ", value = " + scaledValue); - engine.setParameter("[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffect + "]", "mix", scaledValue); - } else { - // Other parameter - //print("Group " + group + ", parameter = " + currentControl + ", value = " + scaledValue); - engine.setParameter(group, "parameter" + currentControl, scaledValue); + if(MaudioXponent.state.focusedEffect != 0) { + var group = "[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffect + "_Effect1]"; + var scaledValue = value / 0x7F; + + if (currentControl == 4) { + // Wet / Dry + //print("Group " + group + ", parameter = " + currentControl + ", value = " + scaledValue); + engine.setParameter("[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffect + "]", "mix", scaledValue); + } else { + // Other parameter + //print("Group " + group + ", parameter = " + currentControl + ", value = " + scaledValue); + engine.setParameter(group, "parameter" + currentControl, scaledValue); + } } } else { var group = "[EffectRack1_EffectUnit" + currentControl + "]"; @@ -624,11 +626,11 @@ MaudioXponent.fx = function(channel, control, value, status) { } } else { // Change focus - MaudioXponent.state.focusedEffect = currentControl; + MaudioXponent.state.focusedEffect = currentControl; } // Light the focused effect - for(i = 0; i < 4; i++) { + for (i = 0; i < 4; i++) { var ctrl = MaudioXponent.leds.fx1 + i; var fxNum = i + 1; var newValue = (fxNum == MaudioXponent.state.focusedEffect) ? 1 : 0; @@ -641,7 +643,7 @@ MaudioXponent.fx = function(channel, control, value, status) { }; MaudioXponent.onTrackLoaded = function(duration, group) { - var deck = MaudioXponent.getDeck[group]; + var deck = MaudioXponent.getDeck(group); deck.warnAt = (duration - 30) / parseFloat(duration); }; From 5e8a2a8f0976e401547be19ee7c136470c6b7b11 Mon Sep 17 00:00:00 2001 From: Mel Grubb Date: Sun, 26 Feb 2017 22:14:33 -0500 Subject: [PATCH 04/20] Added M-Audio Xponent (Advanced) mapping. --- build/nsis/Mixxx.nsi | 2 + .../M-Audio Xponent (Advanced).midi.xml | 3310 +++++++++++++---- .../M-Audio-Xponent-Advanced-scripts.js | 851 +++-- 3 files changed, 3043 insertions(+), 1120 deletions(-) diff --git a/build/nsis/Mixxx.nsi b/build/nsis/Mixxx.nsi index d78ff08e7515..3594ec474242 100644 --- a/build/nsis/Mixxx.nsi +++ b/build/nsis/Mixxx.nsi @@ -459,6 +459,8 @@ Section "Uninstall" Delete "$INSTDIR\controllers\lodash.mixxx.js" Delete "$INSTDIR\controllers\M-Audio-Xponent-scripts.js" Delete "$INSTDIR\controllers\M-Audio_Xponent.midi.xml" + Delete "$INSTDIR\controllers\M-Audio-Xponent-Advanced-scripts.js" + Delete "$INSTDIR\controllers\M-Audio Xponent (Advanced).midi.xml" Delete "$INSTDIR\controllers\korg_nanokontrol2.mixco.output.js" Delete "$INSTDIR\controllers\korg_nanokontrol2.mixco.output.midi.xml" Delete "$INSTDIR\controllers\M-Audio_Xsession_pro.midi.xml" diff --git a/res/controllers/M-Audio Xponent (Advanced).midi.xml b/res/controllers/M-Audio Xponent (Advanced).midi.xml index 7e9423272f61..9ecd4ca002ae 100644 --- a/res/controllers/M-Audio Xponent (Advanced).midi.xml +++ b/res/controllers/M-Audio Xponent (Advanced).midi.xml @@ -17,1011 +17,1112 @@ - [Channel1] - MaudioXponent.secondaryoff - 0x80 - 0x2C + [Master] + MaudioXponent.bankSwitch + Bank A Switch + 0x92 + 0x03 - [Channel2] - MaudioXponent.secondaryoff - 0x81 - 0x2C + [Master] + MaudioXponent.bankSwitch + Bank A Switch + 0x82 + 0x03 + [Channel1] - MaudioXponent.beatgridLoop - Loop 8 release - 0x80 - 0x28 + MaudioXponent.beatsync + Channel 1 Sync Press + 0x90 + 0x02 - [Channel2] - MaudioXponent.beatgridLoop - Loop 8 release - 0x81 - 0x28 + [Channel1] + MaudioXponent.beatsync + Channel 1 Sync Release + 0x80 + 0x02 + - [Channel1] - MaudioXponent.beatgridLoop - Loop 4 release - 0x80 - 0x27 + [Channel2] + MaudioXponent.beatsync + Channel 2 Sync Press + 0x91 + 0x02 [Channel2] - MaudioXponent.beatgridLoop - Loop 4 release + MaudioXponent.beatsync + Channel 2 Sync Release 0x81 - 0x27 + 0x02 + - [Channel1] - MaudioXponent.beatgridLoop - Loop 2 release - 0x80 - 0x26 + [Channel3] + MaudioXponent.beatsync + Channel 3 Sync Press + 0x95 + 0x02 - [Channel2] - MaudioXponent.beatgridLoop - Loop 2 release - 0x81 - 0x26 + [Channel3] + MaudioXponent.beatsync + Channel 3 Sync Release + 0x85 + 0x02 + - [Channel1] - MaudioXponent.beatgridLoop - Loop 1 release - 0x80 - 0x25 + [Channel4] + MaudioXponent.beatsync + Channel 4 Sync Press + 0x96 + 0x02 - [Channel2] - MaudioXponent.beatgridLoop - Loop 1 release - 0x81 - 0x25 + [Channel4] + MaudioXponent.beatsync + Channel 4 Sync Release + 0x86 + 0x02 + [Channel1] - play - button - 0x80 - 0x24 - - - - - - [Channel2] - play - button - 0x81 - 0x24 + MaudioXponent.punchIn + Channel 1 Punch-In Press + 0x90 + 0x07 - + [Channel1] - MaudioXponent.cuedefoff + MaudioXponent.punchIn + Channel 1 Punch-In Release 0x80 - 0x23 + 0x07 + [Channel2] - MaudioXponent.cuedefoff - 0x81 - 0x23 + MaudioXponent.punchIn + Channel 2 Punch-In Press + 0x91 + 0x07 - [Channel1] - MaudioXponent.actbinstop - 0x80 - 0x22 + [Channel2] + MaudioXponent.punchIn + Channel 2 Punch-In Release + 0x81 + 0x07 + - [Channel2] - MaudioXponent.actbinstop - 0x81 - 0x22 + [Channel3] + MaudioXponent.punchIn + Channel 3 Punch-In Press + 0x95 + 0x07 - [Channel1] - MaudioXponent.actbinstop - 0x80 - 0x21 + [Channel3] + MaudioXponent.punchIn + Channel 3 Punch-In Release + 0x85 + 0x07 + - [Channel2] - MaudioXponent.actbinstop - 0x81 - 0x21 + [Channel4] + MaudioXponent.punchIn + Channel 4 Punch-In Press + 0x96 + 0x07 - [Channel1] - rate_perm_down - Speed-- - 0x80 - 0x20 + [Channel4] + MaudioXponent.punchIn + Channel 4 Punch-In Release + 0x86 + 0x07 - + + - [Channel2] - rate_perm_down - Speed-- - 0x81 - 0x20 + [Channel1] + MaudioXponent.filterKill + Channel 1 Low Button Press + 0x90 + 0x08 - + [Channel1] - rate_perm_up - Speed++ + MaudioXponent.filterKill + Channel 1 Low Button Release + button 0x80 - 0x1F + 0x08 - + - [Channel2] - rate_perm_up - Speed++ - 0x81 - 0x1F + [Channel1] + filterLow + Channel 1 Low Knob + 0xB0 + 0x08 - + - + + - [Channel1] - MaudioXponent.secondaryon - 0x90 - 0x2C + [Channel2] + MaudioXponent.filterKill + Channel 2 Low Button Press + 0x91 + 0x08 [Channel2] - MaudioXponent.secondaryon - 0x91 - 0x2C + MaudioXponent.filterKill + Channel 2 Low Button Release + 0x81 + 0x08 - [Channel1] - MaudioXponent.loopout - 0x90 - 0x2B + [Channel2] + filterLow + Channel 2 Low Knob + 0xB1 + 0x08 - + + - [Channel1] - MaudioXponent.hotcue - Hotcue 5 release - 0x80 - 0x1B + [Channel3] + MaudioXponent.filterKill + Channel 3 Low Button Press + 0x95 + 0x08 - [Channel2] - MaudioXponent.loopout - 0x91 - 0x2B + [Channel3] + MaudioXponent.filterKill + Channel 3 Low Button Release + 0x85 + 0x08 - [Channel1] - MaudioXponent.loopexit - 0x90 - 0x2A + [Channel3] + filterLow + Channel 3 Low Knob + 0xB5 + 0x08 - + + - [Channel2] - MaudioXponent.hotcue - Hotcue 5 release - 0x81 - 0x1B + [Channel4] + MaudioXponent.filterKill + Channel 4 Low Button Press + 0x96 + 0x08 - [Channel1] - MaudioXponent.hotcue - Hotcue 4 release - 0x80 - 0x1A + [Channel4] + MaudioXponent.filterKill + Channel 4 Low Button Release + 0x86 + 0x08 - [Channel2] - MaudioXponent.loopexit - 0x91 - 0x2A + [Channel4] + filterLow + Channel 4 Low Knob + 0xB6 + 0x08 - + + + [Channel1] - MaudioXponent.loopin + MaudioXponent.filterKill + Channel 1 Mid Button Press 0x90 - 0x29 + 0x09 - [Channel2] - MaudioXponent.hotcue - Hotcue 4 release - 0x81 - 0x1A + [Channel1] + MaudioXponent.filterKill + Channel 1 Mid Button Release + 0x80 + 0x09 [Channel1] - MaudioXponent.hotcue - Hotcue 3 release - 0x80 - 0x19 + filterMid + Channel 1 Mid Knob + 0xB0 + 0x09 - + - + + [Channel2] - MaudioXponent.loopin + MaudioXponent.filterKill + Channel 2 Mid Button Press 0x91 - 0x29 - - - - - - [Channel1] - MaudioXponent.beatgridLoop - Loop 8 press - 0x90 - 0x28 + 0x09 [Channel2] - MaudioXponent.hotcue - Hotcue 3 release + MaudioXponent.filterKill + Channel 2 Mid Button Release 0x81 - 0x19 + 0x09 - [Channel1] - MaudioXponent.hotcue - Hotcue 2 release - 0x80 - 0x18 + [Channel2] + filterMid + Channel 2 Mid Knob + 0xB1 + 0x09 - + + - [Channel2] - MaudioXponent.beatgridLoop - Loop 8 press - 0x91 - 0x28 + [Channel3] + MaudioXponent.filterKill + Channel 3 Mid Button Press + 0x95 + 0x09 - [Channel1] - MaudioXponent.beatgridLoop - Loop 4 press - 0x90 - 0x27 + [Channel3] + MaudioXponent.filterKill + Channel 3 Mid Button Release + 0x85 + 0x09 - [Channel2] - MaudioXponent.hotcue - Hotcue 2 release - 0x81 - 0x18 + [Channel3] + filterMid + Channel 3 Mid Knob + 0xB5 + 0x09 - + + - [Channel1] - MaudioXponent.hotcue - Hotcue 1 release - 0x80 - 0x17 + [Channel4] + MaudioXponent.filterKill + Channel 4 Mid Button Press + 0x96 + 0x09 - [Channel2] - MaudioXponent.beatgridLoop - Loop 4 press - 0x91 - 0x27 + [Channel4] + MaudioXponent.filterKill + Channel 4 Mid Button Release + 0x86 + 0x09 + + [Channel4] + filterMid + Channel 4 Mid Knob + 0xB6 + 0x09 + + + + + [Channel1] - MaudioXponent.beatgridLoop - Loop 2 press + MaudioXponent.filterKill + Channel 1 High Button Press 0x90 - 0x26 + 0x0A - [Channel2] - MaudioXponent.hotcue - Hotcue 1 release - 0x81 - 0x17 + [Channel1] + MaudioXponent.filterKill + Channel 1 High Button Release + 0x80 + 0x0A [Channel1] - MaudioXponent.wheelTouch - 0x80 - 0x16 + filterHigh + Channel 1 High Knob + 0xB0 + 0x0A - + + [Channel2] - MaudioXponent.beatgridLoop - Loop 2 press + MaudioXponent.filterKill + Channel 2 High Button Press 0x91 - 0x26 + 0x0A - + - [Channel1] - MaudioXponent.beatgridLoop - Loop 1 press - 0x90 - 0x25 + [Channel2] + MaudioXponent.filterKill + Channel 2 High Button Release + 0x81 + 0x0A [Channel2] - MaudioXponent.wheelTouch - 0x81 - 0x16 + filterHigh + Channel 2 High Knob + 0xB1 + 0x0A - + + - [Channel2] - MaudioXponent.beatgridLoop - Loop 1 press - 0x91 - 0x25 + [Channel3] + MaudioXponent.filterKill + Channel 3 High Button Press + 0x95 + 0x0A - + - [Channel1] - MaudioXponent.actbin - 0x90 - 0x24 + [Channel3] + MaudioXponent.filterKill + Channel 3 High Button Release + 0x85 + 0x0A - [Channel1] - MaudioXponent.actbinstop - 0x80 - 0x13 + [Channel3] + filterHigh + Channel 3 High Knob + 0xB5 + 0x0A - + + - [Channel2] - MaudioXponent.actbin - 0x91 - 0x24 + [Channel4] + MaudioXponent.filterKill + Channel 4 High Button Press + 0x96 + 0x0A - + - [Channel1] - MaudioXponent.cuedefon - 0x90 - 0x23 + [Channel4] + MaudioXponent.filterKill + Channel 4 High Button Release + 0x86 + 0x0A - [Channel2] - MaudioXponent.actbinstop - 0x81 - 0x13 + [Channel4] + filterHigh + Channel 4 High Knob + 0xB6 + 0x0A - + + [Channel1] - MaudioXponent.brake - 0x80 - 0x12 + MaudioXponent.filterKill + Channel 1 Gain Button Press + 0x90 + 0x0B - [Channel2] - MaudioXponent.cuedefon - 0x91 - 0x23 + [Channel1] + MaudioXponent.filterKill + Channel 1 Gain Button Release + 0x80 + 0x0B [Channel1] - MaudioXponent.actbin - 0x90 - 0x22 + pregain + Channel 1 Gain Knob + 0xB0 + 0x0B - + + [Channel2] - MaudioXponent.brake - 0x81 - 0x12 + MaudioXponent.filterKill + Channel 2 Gain Button Press + 0x91 + 0x0B - [Channel1] - MaudioXponent.nudge - button - 0x80 - 0x11 + [Channel2] + MaudioXponent.filterKill + Channel 2 Gain Button Release + 0x81 + 0x0B - + [Channel2] - MaudioXponent.actbin - 0x91 - 0x22 + pregain + Channel 2 Gain Knob + 0xB1 + 0x0B - + + - [Channel1] - MaudioXponent.actbin - 0x90 - 0x21 + [Channel3] + MaudioXponent.filterKill + Channel 3 Gain Button Press + 0x95 + 0x0B - [Channel2] - MaudioXponent.nudge - button - 0x81 - 0x11 + [Channel3] + MaudioXponent.filterKill + Channel 3 Gain Button Release + 0x85 + 0x0B + + + [Channel3] + pregain + Channel 3 Gain Knob + 0xB5 + 0x0B + + + + - [Channel1] - MaudioXponent.nudge - button - 0x80 - 0x10 + [Channel4] + MaudioXponent.filterKill + Channel 4 Gain Button Press + 0x96 + 0x0B - [Channel2] - MaudioXponent.actbin - 0x91 - 0x21 + [Channel4] + MaudioXponent.filterKill + Channel 4 Gain Button Release + 0x86 + 0x0B - + - [Channel1] - rate_perm_down - Speed-- - 0x90 - 0x20 + [Channel4] + pregain + Channel 4 Gain Knob + 0xB6 + 0x0B - + + - [Channel2] - MaudioXponent.nudge - button - 0x81 - 0x10 + [Sampler1] + MaudioXponent.sampler + Sampler 1 Button Press + 0x90 + 0x0C - [Channel2] - rate_perm_down - Speed-- - 0x91 - 0x20 + [Sampler1] + MaudioXponent.sampler + Sampler 1 Button Press + 0x95 + 0x0C - + - [Channel1] - rate_perm_up - Speed++ - 0x90 - 0x1F + [Sampler1] + pregain + Sampler 1 Knob + 0xB0 + 0x0C - + - [Channel2] - rate_perm_up - Speed++ - 0x91 - 0x1F + [Sampler1] + pregain + Sampler 1 Knob + 0xB5 + 0x0C - + + - [Channel1] - MaudioXponent.toggleKeylock + [Sampler2] + MaudioXponent.sampler + Sampler 2 Button Press 0x90 - 0x1E + 0x0D - [Channel2] - MaudioXponent.toggleKeylock - 0x91 - 0x1E + [Sampler2] + MaudioXponent.sampler + Sampler 2 Button Press + 0x95 + 0x0D - [Channel1] - MaudioXponent.beatgridAdjust - 0x90 - 0x1D + [Sampler2] + pregain + Sampler 2 Knob + 0xB0 + 0x0D - + - [Channel2] - MaudioXponent.beatgridAdjust - 0x91 - 0x1D + [Sampler2] + pregain + Sampler 2 Knob + 0xB5 + 0x0D - + + + - [Channel1] - MaudioXponent.beatgridAdjust + [Sampler3] + MaudioXponent.sampler + Sampler 3 Button Press 0x90 - 0x1C + 0x0E - [Channel1] - MaudioXponent.volbuttonoff - 0x80 - 0x0B + [Sampler3] + MaudioXponent.sampler + Sampler 3 Button Press + 0x95 + 0x0E - [Channel2] - MaudioXponent.beatgridAdjust - 0x91 - 0x1C + [Sampler3] + pregain + Sampler 3 Knob + 0xB0 + 0x0E - + + + + + [Sampler3] + pregain + Sampler 3 Knob + 0xB5 + 0x0E + + + - [Channel1] - MaudioXponent.hotcue - Hotcue 5 press + [Sampler4] + MaudioXponent.sampler + Sampler 4 Button Press 0x90 - 0x1B + 0x0F - [Channel2] - MaudioXponent.volbuttonoff - 0x81 - 0x0B + [Sampler4] + MaudioXponent.sampler + Sampler 4 Button Press + 0x95 + 0x0F - [Channel1] - filterHighKill - button - 0x80 - 0x0A + [Sampler4] + pregain + Sampler 4 Knob + 0xB0 + 0x0F - + - [Channel2] - MaudioXponent.hotcue - Hotcue 5 press - 0x91 - 0x1B + [Sampler4] + pregain + Sampler 4 Knob + 0xB5 + 0x0F - + + - [Channel1] - MaudioXponent.hotcue - Hotcue 4 press - 0x90 - 0x1A + [Channel2] + MaudioXponent.effectButton + Effect Button 1 Press + 0x91 + 0x0C [Channel2] - filterHighKill - button - 0x81 - 0x0A + MaudioXponent.effectButton + Effect Button 2 Press + 0x91 + 0x0D - + - [Channel1] - filterMidKill - button - 0x80 - 0x09 + [Channel2] + MaudioXponent.effectButton + Effect Button 3 Press + 0x91 + 0x0E - + [Channel2] - MaudioXponent.hotcue - Hotcue 4 press + MaudioXponent.effectButton + Effect Button 4 Press 0x91 - 0x1A + 0x0F + - [Channel1] - MaudioXponent.hotcue - Hotcue 3 press - 0x90 - 0x19 + [Channel4] + MaudioXponent.effectButton + Effect Button 1 Press + 0x96 + 0x0C - [Channel1] - MaudioXponent.hotcue - Hotcue 2 press - 0x90 - 0x18 + [Channel4] + MaudioXponent.effectButton + Effect Button 2 Press + 0x96 + 0x0D - [Channel2] - filterMidKill - button - 0x81 - 0x09 + [Channel4] + MaudioXponent.effectButton + Effect Button 3 Press + 0x96 + 0x0E - + - [Channel1] - filterLowKill - button - 0x80 - 0x08 + [Channel4] + MaudioXponent.effectButton + Effect Button 4 Press + 0x96 + 0x0F - + + [Channel2] - MaudioXponent.hotcue - Hotcue 3 press - 0x91 - 0x19 + MaudioXponent.effectParameter + Effect Parameter 1 Knob + 0xB1 + 0x0C [Channel2] - MaudioXponent.hotcue - Hotcue 2 press - 0x91 - 0x18 + MaudioXponent.effectParameter + Effect Parameter 2 Knob + 0xB1 + 0x0D - [Channel1] - MaudioXponent.hotcue - Hotcue 1 press - 0x90 - 0x17 + [Channel2] + MaudioXponent.effectParameter + Effect Parameter 3 Knob + 0xB1 + 0x0E [Channel2] - filterLowKill - button - 0x81 - 0x08 + MaudioXponent.effectParameter + Effect Parameter 4 Knob + 0xB1 + 0x0F - + - + + - [Channel1] - MaudioXponent.punchIn - 0x80 - 0x07 + [Channel4] + MaudioXponent.effectParameter + Effect Parameter 1 Knob + 0xB6 + 0x0C - + - [Channel2] - MaudioXponent.hotcue - Hotcue 1 press - 0x91 - 0x17 + [Channel4] + MaudioXponent.effectParameter + Effect Parameter 2 Knob + 0xB6 + 0x0D - + - [Channel1] - MaudioXponent.wheelTouch - 0x90 - 0x16 + [Channel4] + MaudioXponent.effectParameter + Effect Parameter 3 Knob + 0xB6 + 0x0E - [Channel2] - MaudioXponent.punchIn - 0x81 - 0x07 + [Channel4] + MaudioXponent.effectParameter + Effect Parameter 4 Knob + 0xB6 + 0x0F - + + - [Channel2] - MaudioXponent.wheelTouch - 0x91 - 0x16 + [Channel1] + MaudioXponent.nudge + Channel 1 Nudge Left Button Press + 0x90 + 0x10 [Channel1] - MaudioXponent.toggleScratchMode - 0x90 - 0x15 + MaudioXponent.nudge + Channel 1 Nudge Left Button Release + 0x80 + 0x10 + [Channel2] - MaudioXponent.toggleScratchMode + MaudioXponent.nudge + Channel 2 Nudge Left Button Press 0x91 - 0x15 + 0x10 - [Channel1] - MaudioXponent.pfl - 0x90 - 0x14 + [Channel2] + MaudioXponent.nudge + Channel 2 Nudge Left Button Release + 0x81 + 0x10 + + - [Channel2] - MaudioXponent.pfl - 0x91 - 0x14 + [Channel3] + MaudioXponent.nudge + Channel 3 Nudge Left Button Press + 0x95 + 0x10 - [Channel1] - MaudioXponent.actbin - 0x90 - 0x13 + [Channel3] + MaudioXponent.nudge + Channel 3 Nudge Left Button Release + 0x85 + 0x10 + - [Channel2] - MaudioXponent.actbin - 0x91 - 0x13 + [Channel4] + MaudioXponent.nudge + Channel 4 Nudge Left Button Press + 0x96 + 0x10 - [Channel1] - MaudioXponent.brake - 0x90 - 0x12 + [Channel4] + MaudioXponent.nudge + Channel 4 Nudge Left Button Release + 0x86 + 0x10 + - [Channel2] - MaudioXponent.brake - 0x91 - 0x12 + [Channel1] + MaudioXponent.nudge + Channel 1 Nudge Right Button Press + 0x90 + 0x11 @@ -1029,17 +1130,18 @@ [Channel1] MaudioXponent.nudge - button - 0x90 + Channel 1 Nudge Right Button Release + 0x80 0x11 + [Channel2] MaudioXponent.nudge - button + Channel 2 Nudge Right Button Press 0x91 0x11 @@ -1047,402 +1149,2030 @@ - [Channel1] + [Channel2] MaudioXponent.nudge - button - 0x90 - 0x10 + Channel 2 Nudge Right Button Release + 0x81 + 0x11 + - [Channel2] + [Channel3] MaudioXponent.nudge - button - 0x91 - 0x10 + Channel 3 Nudge Right Button Press + 0x95 + 0x11 - [Sampler4] - cue_gotoandplay - 0x90 - 0x0F + [Channel3] + MaudioXponent.nudge + Channel 3 Nudge Right Button Release + 0x85 + 0x11 - + + - [Channel2] - MaudioXponent.fx - 0x91 - 0x0F + [Channel4] + MaudioXponent.nudge + Channel 4 Nudge Right Button Press + 0x96 + 0x11 - [Sampler3] - cue_gotoandplay - 0x90 - 0x0E + [Channel4] + MaudioXponent.nudge + Channel 4 Nudge Right Button Release + 0x86 + 0x11 - + + - [Channel2] - MaudioXponent.fx - 0x91 - 0x0E + [Channel1] + MaudioXponent.brake + Channel 1 Brake Button Press + 0x90 + 0x12 - [Sampler2] - cue_gotoandplay - 0x90 - 0x0D + [Channel1] + MaudioXponent.brake + Channel 1 Brake Button Release + 0x80 + 0x12 - + + [Channel2] - MaudioXponent.fx + MaudioXponent.brake + Channel 2 Brake Button Press 0x91 - 0x0D + 0x12 - [Sampler1] - cue_gotoandplay - 0x90 - 0x0C + [Channel2] + MaudioXponent.brake + Channel 2 Brake Button Release + 0x81 + 0x12 - + + - [Channel2] - MaudioXponent.fx - 0x91 - 0x0C + [Channel3] + MaudioXponent.brake + Channel 3 Brake Button Press + 0x95 + 0x12 - [Channel1] - MaudioXponent.volbuttonon - 0x90 - 0x0B + [Channel3] + MaudioXponent.brake + Channel 3 Brake Button Release + 0x85 + 0x12 + - [Channel2] - MaudioXponent.volbuttonon - 0x91 - 0x0B + [Channel4] + MaudioXponent.brake + Channel 4 Brake Button Press + 0x96 + 0x12 - [Channel1] - MaudioXponent.actbin - 0x90 - 0x0A + [Channel4] + MaudioXponent.brake + Channel 4 Brake Button Release + 0x86 + 0x12 + - [Channel2] - MaudioXponent.actbin - 0x91 - 0x0A + [Channel1] + MaudioXponent.reverse + Channel 1 Reverse Button Press + 0x90 + 0x13 [Channel1] - MaudioXponent.actbin - 0x90 - 0x09 + MaudioXponent.reverse + Channel 1 Reverse Button Release + 0x80 + 0x13 + [Channel2] - MaudioXponent.actbin + MaudioXponent.reverse + Channel 2 Reverse Button Press 0x91 - 0x09 + 0x13 - [Channel1] - MaudioXponent.actbin - 0x90 - 0x08 + [Channel2] + MaudioXponent.reverse + Channel 2 Reverse Button Release + 0x81 + 0x13 + + - [Channel2] - MaudioXponent.actbin - 0x91 - 0x08 + [Channel3] + MaudioXponent.reverse + Channel 3 Reverse Button Press + 0x95 + 0x13 - [Channel1] - MaudioXponent.punchIn - 0x90 - 0x07 + [Channel3] + MaudioXponent.reverse + Channel 3 Reverse Button Release + 0x85 + 0x13 + - [Channel2] - MaudioXponent.punchIn - 0x91 - 0x07 + [Channel4] + MaudioXponent.reverse + Channel 4 Reverse Button Press + 0x96 + 0x13 + + + + + + [Channel4] + MaudioXponent.reverse + Channel 4 Reverse Button Release + 0x86 + 0x13 + [Channel1] - beatsync - button + MaudioXponent.pfl + Channel 1 Pre-Fade Listen Button Press 0x90 - 0x02 + 0x14 - + [Channel2] - beatsync - button + MaudioXponent.pfl + Channel 2 Pre-Fade Listen Button Press 0x91 - 0x02 + 0x14 - + - [Channel1] - MaudioXponent.wheel - 0xB0 - 0x16 + [Channel3] + MaudioXponent.pfl + Channel 3 Pre-Fade Listen Button Press + 0x95 + 0x14 - [Channel2] - MaudioXponent.wheel - 0xB1 - 0x16 + [Channel4] + MaudioXponent.pfl + Channel 4 Pre-Fade Listen Button Press + 0x96 + 0x14 + - [Sampler4] - pregain - 0xB0 - 0x0F + [Channel1] + MaudioXponent.toggleScratchMode + Channel 1 Scratch Button Press + 0x90 + 0x15 - + - [Sampler3] - pregain - 0xB0 - 0x0E + [Channel2] + MaudioXponent.toggleScratchMode + Channel 2 Scratch Button Press + 0x91 + 0x15 - + - [Channel2] - MaudioXponent.fx - 0xB1 - 0x0F + [Channel3] + MaudioXponent.toggleScratchMode + Channel 3 Scratch Button Press + 0x95 + 0x15 - [Sampler2] - pregain - 0xB0 - 0x0D + [Channel4] + MaudioXponent.toggleScratchMode + Channel 4 Scratch Button Press + 0x96 + 0x15 - + - + + - [Channel2] - MaudioXponent.fx - 0xB1 - 0x0E + [Channel1] + MaudioXponent.wheelTouch + Channel 1 Wheel Press + 0x90 + 0x16 - [Sampler1] - pregain - 0xB0 - 0x0C + [Channel1] + MaudioXponent.wheelTouch + Channel 1 Wheel Release + 0x80 + 0x16 - + + [Channel2] - MaudioXponent.fx - 0xB1 - 0x0D + MaudioXponent.wheelTouch + Channel 2 Wheel Press + 0x91 + 0x16 - [Master] - headMix - fader - 0xB2 - 0x0D + [Channel2] + MaudioXponent.wheelTouch + Channel 2 Wheel Release + 0x81 + 0x16 - + + - [Channel1] - pregain - fader - 0xB0 - 0x0B + [Channel3] + MaudioXponent.wheelTouch + Channel 3 Wheel Press + 0x95 + 0x16 - + - [Channel2] - MaudioXponent.fx - 0xB1 - 0x0C + [Channel3] + MaudioXponent.wheelTouch + Channel 3 Wheel Release + 0x85 + 0x16 + - [Channel2] - pregain - fader - 0xB1 - 0x0B + [Channel4] + MaudioXponent.wheelTouch + Channel 4 Wheel Press + 0x96 + 0x16 - + + + [Channel4] + MaudioXponent.wheelTouch + Channel 4 Wheel Release + 0x86 + 0x16 + + + + + [Channel1] - filterHigh - fader + MaudioXponent.wheel + Channel 1 Wheel Rotate 0xB0 - 0x0A + 0x16 - + [Channel2] - filterHigh - fader + MaudioXponent.wheel + Channel 2 Wheel Rotate 0xB1 - 0x0A + 0x16 - + - [Channel1] - filterMid - fader - 0xB0 - 0x09 + [Channel3] + MaudioXponent.wheel + Channel 3 Wheel Rotate + 0xB5 + 0x16 - + - [Channel2] - filterMid - fader - 0xB1 - 0x09 + [Channel4] + MaudioXponent.wheel + Channel 4 Wheel Rotate + 0xB6 + 0x16 - + + [Channel1] - filterLow - fader - 0xB0 - 0x08 + MaudioXponent.hotcue + Channel 1 Hotcue 1 Press + 0x90 + 0x17 - + [Channel1] - volume - fader - 0xB0 - 0x07 + MaudioXponent.hotcue + Channel 1 Hotcue 1 Release + 0x80 + 0x17 - + + + + + + [Channel2] + MaudioXponent.hotcue + Channel 1 Hotcue 1 Press + 0x91 + 0x17 + + + + + + [Channel2] + MaudioXponent.hotcue + Channel 1 Hotcue 1 Release + 0x81 + 0x17 + + + + + + + [Channel3] + MaudioXponent.hotcue + Channel 3 Hotcue 1 Press + 0x95 + 0x17 + + + + + + [Channel3] + MaudioXponent.hotcue + Channel 3 Hotcue 1 Release + 0x85 + 0x17 + + + + + + + [Channel4] + MaudioXponent.hotcue + Channel 4 Hotcue 1 Press + 0x96 + 0x17 + + + + + + [Channel4] + MaudioXponent.hotcue + Channel 4 Hotcue 1 Release + 0x86 + 0x17 + + + + + + + [Channel1] + MaudioXponent.hotcue + Channel 1 Hotcue 2 Press + 0x90 + 0x18 + + + + + + [Channel1] + MaudioXponent.hotcue + Channel 1 Hotcue 2 Release + 0x80 + 0x18 + + + + + + + [Channel2] + MaudioXponent.hotcue + Channel 2 Hotcue 2 Press + 0x91 + 0x18 + + + + + + [Channel2] + MaudioXponent.hotcue + Channel 2 Hotcue 2 Release + 0x81 + 0x18 + + + + + + + [Channel3] + MaudioXponent.hotcue + Channel 3 Hotcue 2 Press + 0x95 + 0x18 + + + + + + [Channel3] + MaudioXponent.hotcue + Channel 3 Hotcue 2 Release + 0x85 + 0x18 + + + + + + + [Channel4] + MaudioXponent.hotcue + Channel 4 Hotcue 2 Press + 0x96 + 0x18 + + + + + + [Channel4] + MaudioXponent.hotcue + Channel 4 Hotcue 2 Release + 0x86 + 0x18 + + + + + + + [Channel1] + MaudioXponent.hotcue + Channel 1 Hotcue 3 Press + 0x90 + 0x19 + + + + + + [Channel1] + MaudioXponent.hotcue + Channel 1 Hotcue 3 Release + 0x80 + 0x19 + + + + + + + [Channel2] + MaudioXponent.hotcue + Channel 2 Hotcue 3 Press + 0x91 + 0x19 + + + + + + [Channel2] + MaudioXponent.hotcue + Channel 2 Hotcue 3 Release + 0x81 + 0x19 + + + + + + + [Channel3] + MaudioXponent.hotcue + Channel 31 Hotcue 3 Press + 0x95 + 0x19 + + + + + + [Channel3] + MaudioXponent.hotcue + Channel 3 Hotcue 3 Release + 0x85 + 0x19 + + + + + + + [Channel4] + MaudioXponent.hotcue + Channel 4 Hotcue 3 Press + 0x96 + 0x19 + + + + + + [Channel4] + MaudioXponent.hotcue + Channel 4 Hotcue 3 Release + 0x86 + 0x19 + + + + + + + [Channel1] + MaudioXponent.hotcue + Channel 1 Hotcue 4 Press + 0x90 + 0x1A + + + + + + [Channel1] + MaudioXponent.hotcue + Channel 1 Hotcue 4 Release + 0x80 + 0x1A + + + + + + + [Channel2] + MaudioXponent.hotcue + Channel 2 Hotcue 4 Press + 0x91 + 0x1A + + + + + + [Channel2] + MaudioXponent.hotcue + Channel 2 Hotcue 4 Release + 0x81 + 0x1A + + + + + + + [Channel3] + MaudioXponent.hotcue + Channel 3 Hotcue 4 Press + 0x95 + 0x1A + + + + + + [Channel3] + MaudioXponent.hotcue + Channel 3 Hotcue 4 Release + 0x85 + 0x1A + + + + + + + [Channel4] + MaudioXponent.hotcue + Channel 4 Hotcue 4 Press + 0x96 + 0x1A + + + + + + [Channel4] + MaudioXponent.hotcue + Channel 4 Hotcue 4 Release + 0x86 + 0x1A + + + + + + + [Channel1] + MaudioXponent.hotcue + Channel 1 Hotcue 5 Press + 0x90 + 0x1B + + + + + + [Channel1] + MaudioXponent.hotcue + Channel 1 Hotcue 5 Release + 0x80 + 0x1B + + + + + + + [Channel2] + MaudioXponent.hotcue + Channel 2 Hotcue 5 Press + 0x91 + 0x1B + + + + + + [Channel2] + MaudioXponent.hotcue + Channel 2 Hotcue 5 Release + 0x81 + 0x1B + + + + + + + [Channel3] + MaudioXponent.hotcue + Channel 3 Hotcue 5 Press + 0x95 + 0x1B + + + + + + [Channel3] + MaudioXponent.hotcue + Channel 3 Hotcue 5 Release + 0x85 + 0x1B + + + + + + + [Channel4] + MaudioXponent.hotcue + Channel 4 Hotcue 5 Press + 0x96 + 0x1B + + + + + + [Channel4] + MaudioXponent.hotcue + Channel 4 Hotcue 5 Release + 0x86 + 0x1B + + + + + + + [Channel1] + MaudioXponent.beatgridAdjust + Channel 1 Beatgrid Left Press + 0x90 + 0x1C + + + + + + [Channel2] + MaudioXponent.beatgridAdjust + Channel 2 Beatgrid Left Press + 0x91 + 0x1C + + + + + + [Channel3] + MaudioXponent.beatgridAdjust + Channel 3 Beatgrid Left Press + 0x95 + 0x1C + + + + + + [Channel4] + MaudioXponent.beatgridAdjust + Channel 4 Beatgrid Left Press + 0x96 + 0x1C + + + + + + + [Channel1] + MaudioXponent.beatgridAdjust + Channel 1 Beatgrid Right Press + 0x90 + 0x1D + + + + + + [Channel2] + MaudioXponent.beatgridAdjust + Channel 2 Beatgrid Right Press + 0x91 + 0x1D + + + + + + [Channel3] + MaudioXponent.beatgridAdjust + Channel 3 Beatgrid Right Press + 0x95 + 0x1D + + + + + + [Channel4] + MaudioXponent.beatgridAdjust + Channel 4 Beatgrid Right Press + 0x96 + 0x1D + + + + + + + [Channel1] + MaudioXponent.keyLock + Channel 1 Lock Press + 0x90 + 0x1E + + + + + + [Channel2] + MaudioXponent.keyLock + Channel 2 Lock Press + 0x91 + 0x1E + + + + + + [Channel3] + MaudioXponent.keyLock + Channel 3 Lock Press + 0x95 + 0x1E + + + + + + [Channel4] + MaudioXponent.keyLock + Channel 4 Lock Press + 0x96 + 0x1E + + + + + + + [Channel1] + rate_perm_up + Channel 1 Plus Press + 0x90 + 0x1F + + + + + + [Channel1] + rate_perm_up + Channel 1 Plus Release + 0x80 + 0x1F + + + + + + + [Channel2] + rate_perm_up + Channel 2 Plus Press + 0x91 + 0x1F + + + + + + [Channel2] + rate_perm_up + Channel 2 Plus Release + 0x81 + 0x1F + + + + + + + [Channel3] + rate_perm_up + Channel 3 Plus Press + 0x95 + 0x1F + + + + + + [Channel3] + rate_perm_up + Channel 3 Plus Release + 0x85 + 0x1F + + + + + + + [Channel4] + rate_perm_up + Channel 4 Plus Press + 0x96 + 0x1F + + + + + + [Channel4] + rate_perm_up + Channel 4 Plus Release + 0x86 + 0x1F + + + + + + + [Channel1] + rate_perm_down + Channel 1 Minus Press + 0x90 + 0x20 + + + + + + [Channel1] + rate_perm_down + Channel 1 Minus Release + 0x80 + 0x20 + + + + + + + [Channel2] + rate_perm_down + Channel 2 Minus Press + 0x91 + 0x20 + + + + + + [Channel2] + rate_perm_down + Channel 2 Minus Release + 0x81 + 0x20 + + + + + + + [Channel3] + rate_perm_down + Channel 3 Minus Press + 0x95 + 0x20 + + + + + + [Channel3] + rate_perm_down + Channel 3 Minus Release + 0x85 + 0x20 + + + + + + + [Channel4] + rate_perm_down + Channel 4 Minus Press + 0x96 + 0x20 + + + + + + [Channel4] + rate_perm_down + Channel 4 Minus Release + 0x86 + 0x20 + + + + + + + [Channel1] + MaudioXponent.seek + Channel 1 Seek Left Press + 0x90 + 0x21 + + + + + + [Channel1] + MaudioXponent.seek + Channel 1 Seek Left Release + 0x80 + 0x21 + + + + + + + [Channel2] + MaudioXponent.seek + Channel 2 Seek Left Press + 0x91 + 0x21 + + + + + + [Channel2] + MaudioXponent.seek + Channel 2 Seek Left Release + 0x81 + 0x21 + + + + + + + + [Channel3] + MaudioXponent.seek + Channel 3 Seek Left Press + 0x95 + 0x21 + + + + + + [Channel3] + MaudioXponent.seek + Channel 3 Seek Left Release + 0x85 + 0x21 + + + + + + + [Channel4] + MaudioXponent.seek + Channel 4 Seek Left Press + 0x86 + 0x21 + + + + + + [Channel4] + MaudioXponent.seek + Channel 4 Seek Left Release + 0x96 + 0x21 + + + + + + + [Channel1] + MaudioXponent.seek + Channel 1 Seek Right Press + 0x90 + 0x22 + + + + + + [Channel1] + MaudioXponent.seek + Channel 1 Seek Right Release + 0x80 + 0x22 + + + + + + + [Channel2] + MaudioXponent.seek + Channel 2 Seek Right Press + 0x81 + 0x22 + + + + + + [Channel2] + MaudioXponent.seek + Channel 2 Seek Right Release + 0x91 + 0x22 + + + + + + + [Channel3] + MaudioXponent.seek + Channel 3 Seek Right Press + 0x95 + 0x22 + + + + + + [Channel3] + MaudioXponent.seek + Channel 3 Seek Right Release + 0x85 + 0x22 + + + + + + + [Channel4] + MaudioXponent.seek + Channel 4 Seek Right Press + 0x86 + 0x22 + + + + + + [Channel4] + MaudioXponent.seek + Channel 4 Seek Right Release + 0x96 + 0x22 + + + + + + + [Channel1] + MaudioXponent.cue + Channel 1 Cue Press + 0x90 + 0x23 + + + + + + [Channel1] + MaudioXponent.cue + Channel 1 Cue Release + 0x80 + 0x23 + + + + + + + [Channel2] + MaudioXponent.cue + Channel 2 Cue Press + 0x81 + 0x23 + + + + + + [Channel2] + MaudioXponent.cue + Channel 2 Cue Release + 0x91 + 0x23 + + + + + + + [Channel3] + MaudioXponent.cue + Channel 3 Cue Press + 0x95 + 0x23 + + + + + + [Channel3] + MaudioXponent.cue + Channel 3 Cue Release + 0x85 + 0x23 + + + + + + + [Channel4] + MaudioXponent.cue + Channel 4 Cue Press + 0x86 + 0x23 + + + + + + [Channel4] + MaudioXponent.cue + Channel 4 Cue Release + 0x96 + 0x23 + + + + + + + [Channel1] + MaudioXponent.play + Channel 1 Play/Pause Press + 0x90 + 0x24 + + + + + + [Channel1] + MaudioXponent.play + Channel 1 Play/Pause Release + 0x80 + 0x24 + + + + + + + [Channel2] + MaudioXponent.play + Channel 2 Play/Pause Release + 0x91 + 0x24 + + + + + + [Channel2] + MaudioXponent.play + Channel 2 Play/Pause Press + 0x81 + 0x24 + + + + + + + [Channel3] + MaudioXponent.play + Channel 3 Play/Pause Press + 0x95 + 0x24 + + + + + + [Channel3] + MaudioXponent.play + Channel 3 Play/Pause Release + 0x85 + 0x24 + + + + + + + [Channel4] + MaudioXponent.play + Channel 4 Play/Pause Press + 0x96 + 0x24 + + + + + + [Channel4] + MaudioXponent.play + Channel 4 Play/Pause Release + 0x86 + 0x24 + + + + + + + [Channel1] + MaudioXponent.beatgridLoop + Channel 1 Loop 1 Press + 0x90 + 0x25 + + + + + + [Channel1] + MaudioXponent.beatgridLoop + Channel 1 Loop 1 Release + 0x80 + 0x25 + + + + + + + [Channel2] + MaudioXponent.beatgridLoop + Channel 2 Loop 1 Press + 0x91 + 0x25 + + + + + + [Channel2] + MaudioXponent.beatgridLoop + Channel 2 Loop 1 Release + 0x81 + 0x25 + + + + + + + [Channel3] + MaudioXponent.beatgridLoop + Channel 3 Loop 1 Press + 0x95 + 0x25 + + + + + + [Channel3] + MaudioXponent.beatgridLoop + Channel 3 Loop 1 Release + 0x85 + 0x25 + + + + + + + [Channel4] + MaudioXponent.beatgridLoop + Channel 4 Loop 1 Press + 0x96 + 0x25 + + + + + + [Channel4] + MaudioXponent.beatgridLoop + Channel 4 Loop 1 Release + 0x86 + 0x25 + + + + + + + [Channel1] + MaudioXponent.beatgridLoop + Channel 1 Loop 2 Press + 0x90 + 0x26 + + + + + + [Channel1] + MaudioXponent.beatgridLoop + Channel 1 Loop 2 Release + 0x80 + 0x26 + + + + + + + [Channel2] + MaudioXponent.beatgridLoop + Channel 2 Loop 2 Press + 0x91 + 0x26 + + + + + + [Channel2] + MaudioXponent.beatgridLoop + Channel 2 Loop 2 Release + 0x81 + 0x26 + + + + + + + [Channel3] + MaudioXponent.beatgridLoop + Channel 3 Loop 2 Press + 0x95 + 0x26 + + + + + + [Channel3] + MaudioXponent.beatgridLoop + Channel 3 Loop 2 Release + 0x85 + 0x26 + + + + + + + [Channel4] + MaudioXponent.beatgridLoop + Channel 4 Loop 2 Press + 0x96 + 0x26 + + + + + + [Channel4] + MaudioXponent.beatgridLoop + Channel 4 Loop 2 Release + 0x86 + 0x26 + + + + + + + [Channel1] + MaudioXponent.beatgridLoop + Channel 1 Loop 4 Press + 0x90 + 0x27 + + + + + + [Channel1] + MaudioXponent.beatgridLoop + Channel 1 Loop 4 Release + 0x80 + 0x27 + + + + + + + [Channel2] + MaudioXponent.beatgridLoop + Channel 2 Loop 4 Press + 0x91 + 0x27 + + + + + + [Channel2] + MaudioXponent.beatgridLoop + Channel 2 Loop 4 Release + 0x81 + 0x27 + + + + + + + [Channel3] + MaudioXponent.beatgridLoop + Channel 3 Loop 4 Press + 0x95 + 0x27 + + + + + + [Channel3] + MaudioXponent.beatgridLoop + Channel 3 Loop 4 Release + 0x85 + 0x27 + + + + + + + [Channel4] + MaudioXponent.beatgridLoop + Channel 4 Loop 4 Press + 0x96 + 0x27 + + + + + + [Channel4] + MaudioXponent.beatgridLoop + Channel 4 Loop 4 Release + 0x86 + 0x27 + + + + + + + [Channel1] + MaudioXponent.beatgridLoop + Channel 1 Loop 8 Press + 0x90 + 0x28 + + + + + + [Channel1] + MaudioXponent.beatgridLoop + Channel 1 Loop 8 Release + 0x80 + 0x28 + + + + + + + [Channel2] + MaudioXponent.beatgridLoop + Channel 2 Loop 8 Press + 0x91 + 0x28 + + + + + + [Channel2] + MaudioXponent.beatgridLoop + Channel 2 Loop 8 Release + 0x81 + 0x28 + + + + + + + [Channel3] + MaudioXponent.beatgridLoop + Channel 3 Loop 8 Press + 0x95 + 0x28 + + + + + + [Channel3] + MaudioXponent.beatgridLoop + Channel 3 Loop 8 Release + 0x85 + 0x28 + + + + + + + [Channel4] + MaudioXponent.beatgridLoop + Channel 4 Loop 8 Press + 0x96 + 0x28 + + + + + + [Channel4] + MaudioXponent.beatgridLoop + Channel 4 Loop 8 Release + 0x86 + 0x28 + + + + + + + [Channel1] + MaudioXponent.loopin + Channel 1 Loop In Press + 0x90 + 0x29 + + + + + + [Channel2] + MaudioXponent.loopin + Channel 2 Loop In Press + 0x91 + 0x29 + + + + + + [Channel3] + MaudioXponent.loopin + Channel 3 Loop In Press + 0x95 + 0x29 + + + + + + [Channel4] + MaudioXponent.loopin + Channel 4 Loop In Press + 0x96 + 0x29 + + + + + + + [Channel1] + MaudioXponent.loopexit + Channel 1 Loop Exit Press + 0x90 + 0x2A + + + + + + [Channel2] + MaudioXponent.loopexit + Channel 2 Loop Exit Press + 0x91 + 0x2A + + + + + + [Channel3] + MaudioXponent.loopexit + Channel 3 Loop Exit Press + 0x95 + 0x2A + + + + + + [Channel4] + MaudioXponent.loopexit + Channel 4 Loop Exit Press + 0x96 + 0x2A + + + + + + + [Channel1] + MaudioXponent.loopout + Channel 1 Loop Out Press + 0x90 + 0x2B + + [Channel2] - filterLow - fader - 0xB1 - 0x08 + MaudioXponent.loopout + Channel 2 Loop Out Press + 0x91 + 0x2B - + + + + + [Channel3] + MaudioXponent.loopout + Channel 3 Loop Out Press + 0x95 + 0x2B + + + + + + [Channel4] + MaudioXponent.loopout + Channel 4 Loop Out Press + 0x96 + 0x2B + + + + + + + [Channel1] + MaudioXponent.shift + Channel 1 Shift Press + 0x90 + 0x2C + + + + + + [Channel1] + MaudioXponent.shift + Channel 1 Shift Release + 0x80 + 0x2C + + + + + + + [Channel2] + MaudioXponent.shift + Channel 2 Shift Press + 0x91 + 0x2C + + [Channel2] - volume - fader - 0xB1 + MaudioXponent.shift + Channel 2 Shift Release + 0x81 + 0x2C + + + + + + + [Channel3] + MaudioXponent.shift + Channel 3 Shift Press + 0x95 + 0x2C + + + + + + [Channel3] + MaudioXponent.shift + Channel 3 Shift Release + 0x85 + 0x2C + + + + + + + [Channel4] + MaudioXponent.shift + Channel 4 Shift Press + 0x96 + 0x2C + + + + + + [Channel4] + MaudioXponent.shift + Channel 4 Shift Release + 0x86 + 0x2C + + + + + + + [Master] + crossfader + Crossfader + 0xB2 0x07 @@ -1451,16 +3181,80 @@ [Master] crossfader - fader - 0xB2 + Crossfader + 0xB7 + 0x07 + + + + + + + [Channel1] + volume + Channel 1 Fader + 0xB0 + 0x07 + + + + + + [Channel2] + volume + Channel 2 Fader + 0xB1 + 0x07 + + + + + + [Channel3] + volume + Channel 3 Fader + 0xB5 0x07 + + [Channel4] + volume + Channel 4 Fader + 0xB6 + 0x07 + + + + + + + [Master] + headMix + Headphone Mix + 0xB2 + 0x0D + + + + + + [Master] + headMix + Headphone Mix + 0xB7 + 0x0D + + + + + [Channel1] MaudioXponent.pitch + Channel 1 Rate 0xE0 @@ -1469,82 +3263,94 @@ [Channel2] MaudioXponent.pitch + Channel 2 Rate 0xE1 + + [Channel3] + MaudioXponent.pitch + Channel 3 Rate + 0xE5 + + + + + + [Channel4] + MaudioXponent.pitch + Channel 4 Rate + 0xE6 + + + + [Channel1] - loop_enabled + cue_default 0x90 - 0x2A + 0x23 1 [Channel2] - loop_enabled + cue_default 0x91 - 0x2A - 1 - - - - [Channel1] - pfl - 0x90 - 0x14 + 0x23 1 - [Channel2] - filterLowKill - 0x91 - 0x08 + [Channel3] + cue_default + 0x95 + 0x23 1 - [Channel1] - filterMidKill - 0x90 - 0x09 + [Channel4] + cue_default + 0x96 + 0x23 1 + [Channel1] - pregain_toggle + back 0x90 - 0x0B + 0x21 1 [Channel2] - cue_default + back 0x91 - 0x23 + 0x21 1 - [Channel2] - filterHighKill - 0x91 - 0x0A + [Channel3] + back + 0x95 + 0x21 1 - [Channel2] + [Channel4] back - 0x91 + 0x96 0x21 1 - [Microphone] - talkover + [Channel1] + fwd 0x90 - 0x0D + 0x22 1 @@ -1555,73 +3361,17 @@ 1 - [Channel1] - play - 0x90 - 0x24 - 1 - - - [Channel2] - pfl - 0x91 - 0x14 - 1 - - - [Channel2] - filterMidKill - 0x91 - 0x09 - 1 - - - [Channel2] - pregain_toggle - 0x91 - 0x0B - 1 - - - [Channel1] - filterLowKill - 0x90 - 0x08 - 1 - - - [Channel1] - cue_default - 0x90 - 0x23 - 1 - - - [Channel1] - back - 0x90 - 0x21 - 1 - - - [Channel1] + [Channel3] fwd - 0x90 + 0x95 0x22 1 - [Channel1] - filterHighKill - 0x90 - 0x0A - 1 - - - [Channel2] - play - 0x91 - 0x24 + [Channel4] + fwd + 0x96 + 0x22 1 diff --git a/res/controllers/M-Audio-Xponent-Advanced-scripts.js b/res/controllers/M-Audio-Xponent-Advanced-scripts.js index 0e1d9f17f993..667f8033a5d4 100644 --- a/res/controllers/M-Audio-Xponent-Advanced-scripts.js +++ b/res/controllers/M-Audio-Xponent-Advanced-scripts.js @@ -4,19 +4,34 @@ function MaudioXponent () {} MaudioXponent.id = ""; // The ID for the particular device being controlled for use in debugging, set at init time MaudioXponent.on = 0x90; MaudioXponent.off = 0x80; +MaudioXponent.maxDecks = 0x04; +MaudioXponent.leftDeck; +MaudioXponent.rightDeck; +MaudioXponent.bankA = 0x82; +MaudioXponent.bankB = 0x92; +MaudioXponent.Handshake1 = [0xF0,0x7E,0x7F,0x06,0x01,0xF7]; +MaudioXponent.Handshake2 = [0xF0,0x00,0x20,0x08,0x00,0x00,0x63,0x0E,0x16,0x40,0x00,0x01,0xF7]; +MaudioXponent.Handshake3 = [0xF0,0x00,0x20,0x08,0x00,0x00,0x63,0x0E,0x16,0x40,0x00,0x00,0xF7]; MaudioXponent.config = { - nudgeButtonMode : 0, // 0 = Normal, 1 = Reversed - pflMode : 1, // 0 = Independent, 1 = Toggle - syncFlashMode : 0, // 0 = Off, 1 = Simple, 2 = Toggle - vuMeterMode : 0, // 0 = Per-Channel mode, 1 = Master Mode + nudgeButtonMode : 1, // 0 = Normal, 1 = Reversed + pflMode : 0, // 0 = Independent, 1 = Toggle + syncFlashMode : 0, // 0 = Off, 1 = Pulse, 2 = Toggle + vuMeterMode : 1, // 0 = Master, 1 = Channel } -MaudioXponent.state = { - deck : [], // Stores everything about an individual deck +MaudioXponent.decks = +[ + { noteOffset : 0, on : 0x90, off : 0x80, isLeft : true, isRight : false, isBankA : true, isBankB : false }, + { noteOffset : 1, on : 0x91, off : 0x81, isLeft : false, isRight : true, isBankA : true, isBankB : false }, + { noteOffset : 5, on : 0x95, off : 0x85, isLeft : true, isRight : false, isBankA : false, isBankB : true }, + { noteOffset : 6, on : 0x96, off : 0x86, isLeft : false, isRight : true, isBankA : false, isBankB : true } +]; + +MaudioXponent.state = { + bank : 0, // Which position is the bank switch currently set to? faderPosition : 0, // Temporary storage for cross-fader position during punch-ins. focusedEffect : 0, - numDecks : 0, plnumberpos : 0, plnumberneg : 0, }; @@ -26,8 +41,8 @@ MaudioXponent.leds = { "cue": 0x23, "back": 0x21, "fwd": 0x22, - "in": 0x29, - "out": 0x2B, + "loopIn": 0x29, + "loopOut": 0x2B, "loop": 0x2A, "loop1": 0x25, "loop2": 0x26, @@ -47,25 +62,27 @@ MaudioXponent.leds = { "fx2": 0x0D, "fx3": 0x0E, "fx4": 0x0F, - "leftp": 0x10, - "rightp": 0x11, + "rate_temp_down": MaudioXponent.config.nudgeButtonMode ? 0x11 : 0x10, + "rate_temp_up": MaudioXponent.config.nudgeButtonMode ? 0x10 : 0x11, "bigx": 0x12, - "big-": 0x13, - "head": 0x14, + "reverse": 0x13, + "pfl": 0x14, "scratch": 0x15, - "fadarbutton": 0x07, + "punchIn": 0x07, "sync": 0x02, - "low": 0x08, - "middle": 0x09, - "hight": 0x0A, + "button_parameter1": 0x08, + "button_parameter2": 0x09, + "button_parameter3": 0x0A, "gain": 0x0B, "shift": 0x2C }; MaudioXponent.binleds = { - 8: "filterLowKill", - 9: "filterMidKill", - 10: "filterHighKill", + 8: "button_parameter1", + 9: "button_parameter2", + 10: "button_parameter3", + 16: (MaudioXponent.config.nudgeButtonMode ? "rate_temp_up" : "rate_temp_down"), + 17: (MaudioXponent.config.nudgeButtonMode ? "rate_temp_down" : "rate_temp_up"), 18: "keylock", 19: "reverse", 20: "pfl", @@ -74,68 +91,91 @@ MaudioXponent.binleds = { 36: "play" }; -MaudioXponent.Handshake1 = [0xF0,0x7E,0x7F,0x06,0x01,0xF7]; -MaudioXponent.Handshake2 = [0xF0,0x00,0x20,0x08,0x00,0x00,0x63,0x0E,0x16,0x40,0x00,0x01,0xF7]; -MaudioXponent.Handshake3 = [0xF0,0x00,0x20,0x08,0x00,0x00,0x63,0x0E,0x16,0x40,0x00,0x00,0xF7]; - // ---------- Functions ---------- -MaudioXponent.logParams = function(a, b, c, d, e, f) { - print("a="+ a + ", b=" + b + ", c=" + c + ", d=" + d + ", e=" + e + ", f=" + f); +MaudioXponent.logParams = function(functionName, a, b, c, d, e, f) { + print("***"); + print("*** " + functionName + ": a="+ a + ", b=" + b + ", c=" + c + ", d=" + d + ", e=" + e + ", f=" + f); + print("***"); }; MaudioXponent.init = function (id) { - MaudioXponent.state.numDecks = engine.getValue("[Master]", "num_decks"); - MaudioXponent.initDecks(); MaudioXponent.initLights(); MaudioXponent.syncLights(); + + //MaudioXponent.probeLights(); }; MaudioXponent.initDecks = function() { - if (MaudioXponent.config.vuMeterMode == 1) { - engine.connectControl("[Master]", "VuMeterL", function(value) { MaudioXponent.volumeLEDs(0, value); }); - engine.connectControl("[Master]", "VuMeterR", function(value) { MaudioXponent.volumeLEDs(1, value); }); - } else { - engine.connectControl("[Channel1]", "VuMeter", function(value) { MaudioXponent.volumeLEDs(0, value); }); - engine.connectControl("[Channel2]", "VuMeter", function(value) { MaudioXponent.volumeLEDs(1, value); }); - } - - for (index = 0; index < MaudioXponent.state.numDecks; index++) { - var channel = index + 1; + // Because vuMeter values change rapidly, we're pre-digesting the parameters for this function + engine.connectControl("[Master]", "VuMeterL", function(value) { MaudioXponent.vuMeter(0, 0, 0, value); }); + engine.connectControl("[Master]", "VuMeterR", function(value) { MaudioXponent.vuMeter(0, 0, 1, value); }); + engine.connectControl("[Channel1]", "VuMeterL", function(value) { MaudioXponent.vuMeter(1, MaudioXponent.bankA, 0, value); }); + engine.connectControl("[Channel2]", "VuMeterR", function(value) { MaudioXponent.vuMeter(1, MaudioXponent.bankA, 1, value); }); + engine.connectControl("[Channel3]", "VuMeterL", function(value) { MaudioXponent.vuMeter(1, MaudioXponent.bankB, 0, value); }); + engine.connectControl("[Channel4]", "VuMeterR", function(value) { MaudioXponent.vuMeter(1, MaudioXponent.bankB, 1, value); }); + + for (channel = 1; channel <= MaudioXponent.maxDecks; channel++) { var group = "[Channel" + (channel) + "]"; - var offset = index == 0 ? 0 : index == 1 ? 1 : index == 2 ? 5 : index == 3 ? 6 : 0; - - MaudioXponent.state.deck[index] = { - id : channel, - beatState : false, - group : group, - off : 0x80 + offset, - on : 0x90 + offset, - shift : false, - warnAt : 0, - scratchEnabled : false, - scratching : false, - }; - + var deck = MaudioXponent.decks[channel - 1]; + deck.id = channel; + deck.beatState = false; + deck.group = group; + deck.progressMeterStatusByte = deck.isBankA ? 0xB3 : 0xB8; + deck.progressMeterSecondByte = deck.isLeft ? 0x14 : 0x15; + deck.vuMeterStatusByte = deck.isBankA ? 0xB3 : 0xB8; + deck.vuMeterSecondByte = deck.isLeft ? 0x12 : 0x13; + deck.scratchEnabled = false; + deck.scratching = false; + deck.shift = false; + deck.warnAt = 0; + deck.filterLow = 1; + deck.filterMid = 1; + deck.filterHigh = 1; + deck.pregain = 1; + + engine.connectControl(group, "play", "MaudioXponent.onPlay"); engine.connectControl(group, "playposition", "MaudioXponent.onPlayPositionChange"); engine.connectControl(group, "duration", "MaudioXponent.onTrackLoaded"); engine.connectControl(group, "beat_active", "MaudioXponent.onBeatActive"); + engine.connectControl(group, "eject", "MaudioXponent.onEject"); for (i = 1; i <= 5; i++) { engine.connectControl(group, "hotcue_" + i + "_enabled", "MaudioXponent.onHotCue"); } engine.connectControl(group, "loop_enabled", "MaudioXponent.onLoopExit"); - engine.connectControl(group, "loop_start_position", "MaudioXponent.onLoopIn"); - engine.connectControl(group, "loop_end_position", "MaudioXponent.onLoopOut"); + engine.connectControl(group, "loop_in", "MaudioXponent.onLoopIn"); + engine.connectControl(group, "loop_out", "MaudioXponent.onLoopOut"); for (i = 0.125; i < 16; i *= 2) { engine.connectControl(group, "beatloop_" + i + "_enabled", "MaudioXponent.onBeatLoop"); } - engine.connectControl(group, "keylock", "MaudioXponent.onKeyLock"); + engine.connectControl(group, "keylock", "MaudioXponent.onkeyLock"); engine.connectControl(group, "bpm", "MaudioXponent.onBpmChanged"); + engine.connectControl(group, "pfl", "MaudioXponent.onPflChanged"); + + engine.connectControl(group, "reverse", "MaudioXponent.onReverse"); + engine.connectControl(group, "reverseroll", "MaudioXponent.onReverse"); + engine.connectControl(group, "rate_temp_down", "MaudioXponent.onNudge"); + engine.connectControl(group, "rate_temp_up", "MaudioXponent.onNudge"); + + engine.connectControl("[EqualizerRack1_" + group + "_Effect1]", "button_parameter1", "MaudioXponent.onFilterKill"); + engine.connectControl("[EqualizerRack1_" + group + "_Effect1]", "button_parameter2", "MaudioXponent.onFilterKill"); + engine.connectControl("[EqualizerRack1_" + group + "_Effect1]", "button_parameter3", "MaudioXponent.onFilterKill"); engine.softTakeover(group, "rate", true); + engine.softTakeover(group, "volume", true); + + // Soft-takeovers that aren't yet working correctly (Might need to save/restore on bank change) + engine.softTakeover(group, "filterLow", true); + engine.softTakeover(group, "filterMid", true); + engine.softTakeover(group, "filterHigh", true); + } + + for (i = 1; i <=4; i++) { + var group = "[Sampler" + i + "]"; + engine.connectControl(group, "play", "MaudioXponent.onSampler"); } // Effects parameters... not working in Mixxx 2.0, should work in 2.1 @@ -144,7 +184,25 @@ MaudioXponent.initDecks = function() { engine.softTakeover("[EffectRack1_EffectUnit" + i + "_Effect1]", "parameter2", true); engine.softTakeover("[EffectRack1_EffectUnit" + i + "_Effect1]", "parameter3", true); engine.softTakeover("[EffectRack1_EffectUnit" + i + "]", "mix", true); - } + } + + // TODO: It would be nice to discover some way to force the Xponent to dump its current status. + // Until then, I just have to assume that you start on Bank A + MaudioXponent.bankSwitch(0, 0, 0, MaudioXponent.bankA, 0); +}; + +MaudioXponent.probeLights = function() { + var status = 0xB4; + // for(status = 0xB0; status < 0xC0; status++) { + for (var led in MaudioXponent.leds) { + var byte2 = MaudioXponent.leds[led]; + // for(byte2 = 0; byte2 < 128; byte2++) { + for(byte3 = 0; byte3 < 128; byte3++) { + midi.sendShortMsg(status, byte2, byte3); + MaudioXponent.pauseScript(5); + } + } + // } }; MaudioXponent.initLights = function () { @@ -152,25 +210,22 @@ MaudioXponent.initLights = function () { midi.sendSysexMsg(MaudioXponent.Handshake1, MaudioXponent.Handshake1.length); midi.sendSysexMsg(MaudioXponent.Handshake2, MaudioXponent.Handshake2.length); - // This code light on all leds and then light off - midi.sendShortMsg(0xB3, 0x14, 0x00); - midi.sendShortMsg(0xB3, 0x15, 0x00); - for (var led in MaudioXponent.leds) { - midi.sendShortMsg(MaudioXponent.on, MaudioXponent.leds[led], 0x01); - midi.sendShortMsg(MaudioXponent.on + 1, MaudioXponent.leds[led], 0x01); + midi.sendShortMsg(MaudioXponent.leftDeck.on, MaudioXponent.leds[led], 0x01); + midi.sendShortMsg(MaudioXponent.rightDeck.on, MaudioXponent.leds[led], 0x01); MaudioXponent.pauseScript(15); } - for(i = 0; i <= 10; i+=1){ + for(i = 0; i <= 10; i += 1) { var value = MaudioXponent.convert(i * .1); // VU meters - midi.sendShortMsg(0xB3, 0x12, value); - midi.sendShortMsg(0xB3, 0x13, value); + midi.sendShortMsg(MaudioXponent.leftDeck.vuMeterStatusByte, MaudioXponent.leftDeck.vuMeterSecondByte, value); + midi.sendShortMsg(MaudioXponent.rightDeck.vuMeterStatusByte, MaudioXponent.rightDeck.vuMeterSecondByte, value); // Progress meters - midi.sendShortMsg(0xB3, 0x14, value); - midi.sendShortMsg(0xB3, 0x15, value); + midi.sendShortMsg(MaudioXponent.leftDeck.progressMeterStatusByte, MaudioXponent.leftDeck.progressMeterSecondByte, value); + midi.sendShortMsg(MaudioXponent.rightDeck.progressMeterStatusByte, MaudioXponent.rightDeck.progressMeterSecondByte, value); + MaudioXponent.pauseScript(15); } @@ -183,24 +238,58 @@ MaudioXponent.initLights = function () { } // VU meters - midi.sendShortMsg(0xB3,0x12,0); - midi.sendShortMsg(0xB3,0x13,0); + midi.sendShortMsg(MaudioXponent.leftDeck.vuMeterStatusByte, MaudioXponent.leftDeck.vuMeterSecondByte, 0); + midi.sendShortMsg(MaudioXponent.rightDeck.vuMeterStatusByte, MaudioXponent.rightDeck.vuMeterSecondByte, 0); + + // Progress meters + midi.sendShortMsg(MaudioXponent.leftDeck.progressMeterStatusByte, MaudioXponent.leftDeck.progressMeterSecondByte, 0); + midi.sendShortMsg(MaudioXponent.rightDeck.progressMeterStatusByte, MaudioXponent.rightDeck.progressMeterSecondByte, 0); +}; + +MaudioXponent.shutdown = function (id) { + for (var led in MaudioXponent.leds) { + midi.sendShortMsg(MaudioXponent.on, MaudioXponent.leds[led], 0x00); + midi.sendShortMsg(MaudioXponent.on + 1,MaudioXponent.leds[led], 0x00); + } + + // VU meters + midi.sendShortMsg(MaudioXponent.leftDeck.vuMeterStatusByte, MaudioXponent.leftDeck.vuMeterSecondByte, 0); + midi.sendShortMsg(MaudioXponent.rightDeck.vuMeterStatusByte, MaudioXponent.rightDeck.vuMeterSecondByte, 0); // Progress meters - midi.sendShortMsg(0xB3,0x14,0); - midi.sendShortMsg(0xB3,0x15,0); + midi.sendShortMsg(MaudioXponent.leftDeck.progressMeterStatusByte, MaudioXponent.leftDeck.progressMeterSecondByte, 0); + midi.sendShortMsg(MaudioXponent.rightDeck.progressMeterStatusByte, MaudioXponent.rightDeck.progressMeterSecondByte, 0); + + // Secret Handshake + midi.sendSysexMsg(MaudioXponent.Handshake3, MaudioXponent.Handshake3.length); }; MaudioXponent.syncLights = function() { - for (i = 0; i < MaudioXponent.state.numDecks; i++) { - var channel = i + 1; - var group = "[Channel" + channel + "]"; - engine.trigger(group, "keylock"); - engine.trigger(group, "hotcue_1_enabled"); - engine.trigger(group, "hotcue_2_enabled"); - engine.trigger(group, "hotcue_3_enabled"); - engine.trigger(group, "hotcue_4_enabled"); - engine.trigger(group, "hotcue_5_enabled"); + for (i = 0; i < MaudioXponent.decks.length; i++) { + var deck = MaudioXponent.decks[i]; + + engine.trigger(deck.group, "play"); + engine.trigger(deck.group, "pfl"); + engine.trigger(deck.group, "loop_enabled"); + engine.trigger(deck.group, "loop_start_position"); + engine.trigger(deck.group, "loop_end_position"); + + engine.trigger("[EqualizerRack1_" + deck.group + "_Effect1]", "button_parameter1"); + engine.trigger("[EqualizerRack1_" + deck.group + "_Effect1]", "button_parameter2"); + engine.trigger("[EqualizerRack1_" + deck.group + "_Effect1]", "button_parameter3"); + + engine.trigger(deck.group, "keylock"); + engine.trigger(deck.group, "hotcue_1_enabled"); + engine.trigger(deck.group, "hotcue_2_enabled"); + engine.trigger(deck.group, "hotcue_3_enabled"); + engine.trigger(deck.group, "hotcue_4_enabled"); + engine.trigger(deck.group, "hotcue_5_enabled"); + + engine.trigger(deck.group, "loop_in"); + engine.trigger(deck.group, "loop_out"); + + midi.sendShortMsg(deck.on, MaudioXponent.leds.scratch, deck.scratchEnabled); + MaudioXponent.onPlayPositionChange(deck.playPosition, deck.group); } }; @@ -209,7 +298,7 @@ MaudioXponent.convert = function(value) { }; MaudioXponent.getDeck = function(group) { - return MaudioXponent.state.deck[parseInt(group.substring(8)) - 1]; + return MaudioXponent.decks[parseInt(group.substring(8)) - 1]; }; MaudioXponent.pauseScript = function(ms) { @@ -218,58 +307,220 @@ MaudioXponent.pauseScript = function(ms) { while(currentDate-startDate < ms) currentDate = new Date(); }; +MaudioXponent.vuMeter = function(mode, bank, side, value) { + if (mode === MaudioXponent.config.vuMeterMode) { // Accept messages for the active mode + if ((mode === 0) || (bank === MaudioXponent.state.bank)) { // Accept messages for the active bank + value = MaudioXponent.convert(value); + + if (side === 0) { + midi.sendShortMsg(MaudioXponent.leftDeck.vuMeterStatusByte, MaudioXponent.leftDeck.vuMeterSecondByte, value); + } else { + midi.sendShortMsg(MaudioXponent.rightDeck.vuMeterStatusByte, MaudioXponent.rightDeck.vuMeterSecondByte, value); + } + } + } +} + +MaudioXponent.bankSwitch = function(channel, control, value, status, group) { + //script.midiDebug(channel, control, value, status, group); + MaudioXponent.state.bank = status; + + if (status === MaudioXponent.bankA) { + MaudioXponent.leftDeck = MaudioXponent.decks[0]; + MaudioXponent.rightDeck = MaudioXponent.decks[1]; + } else if (status === MaudioXponent.bankB) { + MaudioXponent.leftDeck = MaudioXponent.decks[2]; + MaudioXponent.rightDeck = MaudioXponent.decks[3]; + } + + MaudioXponent.syncLights(); +}; + +MaudioXponent.beatsync = function(channel, control, value, status, group) { + //script.midiDebug(channel, control, value, status, group); + var deck = MaudioXponent.getDeck(group); + var activate = (status == deck.on); + + if (activate) { + if (MaudioXponent.leftDeck.shift && MaudioXponent.rightDeck.shift) { + // Double-shift = cycle modes + var mode = MaudioXponent.config.syncFlashMode + 1; + if(mode===3){ + mode = 0; + } + MaudioXponent.config.syncFlashMode = mode; + } else { + if (!deck.shift) { + engine.setValue(deck.group, "beatsync", 0x04); + } else { + engine.setValue(deck.group, "bpm_tap", 0x01); + } + } + } + + midi.sendShortMsg(deck.on, MaudioXponent.leds.sync, activate); +}; + +MaudioXponent.punchIn = function(channel, control, value, status, group) { + //script.midiDebug(channel, control, value, status, group) + var deck = MaudioXponent.getDeck(group); + var activate = (status == deck.on); + + if (activate) { + MaudioXponent.state.faderPosition = faderPosition = engine.getValue("[Master]", "crossfader"); + + if ((faderPosition >= 0.90 && deck.isLeft) || (faderPosition <= -0.90 && deck.isRight)) { + engine.setValue("[Master]", "crossfader", 0); + } + } else { + engine.setValue("[Master]", "crossfader", MaudioXponent.state.faderPosition); + } + + midi.sendShortMsg(deck.on, MaudioXponent.leds.punchIn, activate); +}; + +MaudioXponent.filterKill = function(channel, control, value, status, group) { + // script.midiDebug(channel, control, value, status, group); + var deck = MaudioXponent.getDeck(group); + var activate = (status == deck.on); + + if (control === MaudioXponent.leds.gain) { + // Gain Buttons + if (activate && (MaudioXponent.leftDeck.shift && MaudioXponent.rightDeck.shift)) { + //Double-shift = cycle modes + var mode = MaudioXponent.config.vuMeterMode + 1; + if (mode === 2) { + mode = 0; + } + MaudioXponent.config.vuMeterMode = mode; + } else { + if (activate) { + // Save the current value + deck.volume = engine.getValue(deck.group, "volume"); + engine.setValue(deck.group, "volume", 0x00); + } else { + // Restore the saved value from above + engine.setValue(deck.group, "volume", deck.volume); + } + + midi.sendShortMsg(deck.on, MaudioXponent.leds.gain, activate); + } + } else { + // Low/Mid/High Buttons, momentary kill + var group = "[EqualizerRack1_" + deck.group + "_Effect1]"; + engine.setValue(group, MaudioXponent.binleds[control], activate); + } +}; + +MaudioXponent.onFilterKill = function(value, group, control) { + var deck = MaudioXponent.decks[parseInt(group.substring(24)) - 1]; + midi.sendShortMsg(deck.on, MaudioXponent.leds[control], value); +}; + +MaudioXponent.effectButton = function(channel, control, value, status, group) { + //script.midiDebug(channel, control, value, status, group); + var deck = MaudioXponent.getDeck(group); + var currentControl = control - 0x0B; + var group = "[EffectRack1_EffectUnit" + currentControl + "]"; + + if (deck.shift) { + // Cycle effects + engine.setValue(group, "next_chain", 1); + } else { + if (currentControl == MaudioXponent.state.focusedEffect) { + // Toggle enabled + var effectEnabled = engine.getValue(group, "enabled"); + if (effectEnabled) { + engine.setValue(group, "enabled", 0); + } else { + engine.setValue(group, "enabled", 1); + } + } else { + // Change focus + MaudioXponent.state.focusedEffect = currentControl; + } + + // Light the focused effect + for (i = 0; i < 4; i++) { + var ctrl = MaudioXponent.leds.fx1 + i; + var fxNum = i + 1; + var newValue = (fxNum == MaudioXponent.state.focusedEffect) ? 1 : 0; + midi.sendShortMsg(deck.on, ctrl, newValue); + } + } +}; + +MaudioXponent.effectParameter = function(channel, control, value, status, group) { + // script.midiDebug(channel, control, value, status, group); + var deck = MaudioXponent.getDeck(group); + var currentControl = control - 0x0B; + + if (MaudioXponent.state.focusedEffect != 0) { + var group = "[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffect + "_Effect1]"; + var scaledValue = value / 0x7F; + + if (currentControl == 4) { + // Wet / Dry + engine.setParameter("[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffect + "]", "mix", scaledValue); + } else { + // Other parameter + engine.setParameter(group, "parameter" + currentControl, scaledValue); + } + } +}; + MaudioXponent.wheel = function (channel, control, value, status, group) { - var deck = MaudioXponent.state.deck[channel]; + var deck = MaudioXponent.getDeck(group); if (deck.shift) { if (value > 64) { MaudioXponent.state["plnumberpos"]++; if (MaudioXponent.state["plnumberpos"] % 12 == 0) { - engine.setValue("[Playlist]", "SelectTrackKnob",1); + engine.setValue("[Playlist]", "SelectTrackKnob", 1); } } else if (value < 64) { MaudioXponent.state["plnumberneg"]++; if (MaudioXponent.state["plnumberneg"] % 12 == 0) { - engine.setValue("[Playlist]", "SelectTrackKnob",-1); + engine.setValue("[Playlist]", "SelectTrackKnob", -1); } } } else { if (deck.scratching) { - engine.scratchTick(deck.id, value-64); + engine.scratchTick(deck.id, value - 64); } else { - engine.setValue(group, "jog", (value-64)/8); + engine.setValue(group, "jog", (value - 64) / 8); } } }; -MaudioXponent.wheelTouch = function(channel, control, value, status) { - //script.midiDebug(channel, control, value, status) - var deck = MaudioXponent.state.deck[channel]; +MaudioXponent.wheelTouch = function(channel, control, value, status, group) { + //script.midiDebug(channel, control, value, status, group) + var deck = MaudioXponent.getDeck(group); var activate = (status == deck.on); if (activate) { if (deck.scratchEnabled) { - engine.scratchEnable(deck.id, 3*128, 33+1/3, 1.0/8, (1.0/8)/32); + engine.scratchEnable(deck.id, 3 * 128, 33 + 1/3, 1.0/8, (1.0/8)/32); deck.scratching = true; } } else { engine.scratchDisable (deck.id); deck.scratching = false; } -} +}; MaudioXponent.onBeatActive = function(value, group) { var deck = MaudioXponent.getDeck(group); if (MaudioXponent.config.syncFlashMode === 1) { - midi.sendShortMsg(deck.on, 0x02, value); + midi.sendShortMsg(deck.on, MaudioXponent.leds.sync, value); } if (value) { deck.beatState = !deck.beatState; if (MaudioXponent.config.syncFlashMode === 2) { - midi.sendShortMsg(deck.on, 0x02, deck.beatState); + midi.sendShortMsg(deck.on, MaudioXponent.leds.sync, deck.beatState); } } }; @@ -277,9 +528,8 @@ MaudioXponent.onBeatActive = function(value, group) { MaudioXponent.onBeatLoop = function(value, group, control) { var deck = MaudioXponent.getDeck(group); var offset = Math.log(parseInt(control.substring(9))) / Math.log(2) - - midi.sendShortMsg(deck.on, MaudioXponent.leds.loop1 + offset, value); -} + midi.sendShortMsg(deck.on, MaudioXponent.leds.loop1, value); +}; MaudioXponent.onBpmChanged = function(value, group) { //print ("BPM Change, " + group + ", value=" + value); @@ -287,49 +537,21 @@ MaudioXponent.onBpmChanged = function(value, group) { MaudioXponent.onPlayPositionChange = function(value, group) { var deck = MaudioXponent.getDeck(group); - if ((value < deck.warnAt) || (!engine.getValue(group, "play")) || (value >= deck.warnAt && deck.beatState)) { - midi.sendShortMsg(0xB3, 0x13 + deck.id, MaudioXponent.convert(value)); - } else { - midi.sendShortMsg(0xB3, 0x13 + deck.id, 0x00); - } -}; - -MaudioXponent.volumeLEDs = function(channel, value) { - midi.sendShortMsg(0xB3,0x12 + channel, MaudioXponent.convert(value)); -}; - -MaudioXponent.actbin = function(channel, control, value, status) { - //script.midiDebug(channel, control, value, status); - var deck = MaudioXponent.state.deck[channel]; - var activenow = engine.getValue(deck.group, MaudioXponent.binleds[control]); + var status = MaudioXponent.bank + + value = engine.getValue(group, "playposition"); + deck.playPosition = value; - if (activenow) { - print("activenow: group=" + deck.group + ", control=" + MaudioXponent.binleds[control] + ", value=0"); - engine.setValue(deck.group, MaudioXponent.binleds[control], 0); - midi.sendShortMsg(deck.off, control, 0x00); + if ((value < deck.warnAt) || (!engine.getValue(group, "play")) || (value >= deck.warnAt && deck.beatState)) { + midi.sendShortMsg(deck.progressMeterStatusByte, deck.progressMeterSecondByte, MaudioXponent.convert(value)); } else { - print("activenow: group=" + deck.group + ", control=" + MaudioXponent.binleds[control] + ", value=1"); - engine.setValue(deck.group, MaudioXponent.binleds[control], 1); - midi.sendShortMsg(deck.on, control, 0x01); + midi.sendShortMsg(deck.progressMeterStatusByte, deck.progressMeterSecondByte, 0x00); } }; -MaudioXponent.actbinstop = function(channel, control, value, status) { - //script.midiDebug(channel, control, value, status); - var deck = MaudioXponent.state.deck[channel]; - engine.setValue(deck.group, MaudioXponent.binleds[control], 0); - midi.sendShortMsg(deck.off,control,0x00); -}; - -MaudioXponent.onHotCue = function(value, group, control) { - var deck = MaudioXponent.getDeck(group); - var cueNumber = parseInt(control.substring(7)) - 1; - midi.sendShortMsg(deck.on, MaudioXponent.leds.cue1 + cueNumber, value); -} - MaudioXponent.hotcue = function(channel, control, value, status, group) { //script.midiDebug(channel, control, value, status, group) - var deck = MaudioXponent.state.deck[channel]; + var deck = MaudioXponent.getDeck(group); var cueNumber = control - 0x16; if (!deck.shift) { @@ -340,133 +562,99 @@ MaudioXponent.hotcue = function(channel, control, value, status, group) { } }; -MaudioXponent.onLoopIn = function(value, group, control){ +MaudioXponent.onHotCue = function(value, group, control) { var deck = MaudioXponent.getDeck(group); - midi.sendShortMsg(deck.on, 0x29, engine.getValue(group, control) != -1); -} + var cueNumber = parseInt(control.substring(7)) - 1; + midi.sendShortMsg(deck.on, MaudioXponent.leds.cue1 + cueNumber, value); +}; -MaudioXponent.onLoopOut = function(value, group, control) -{ +MaudioXponent.loopin = function(channel, control, value, status, group) { var deck = MaudioXponent.getDeck(group); - midi.sendShortMsg(deck.on, 0x2B, engine.getValue(group, control) != -1); -} + engine.setValue(deck.group, "loop_in", !deck.shift); +}; -MaudioXponent.onLoopExit = function(value, group, control) -{ +MaudioXponent.onLoopIn = function(value, group, control) { var deck = MaudioXponent.getDeck(group); - midi.sendShortMsg(deck.on, 0x2A, engine.getValue(group, control) == 1); -} + midi.sendShortMsg(deck.on, MaudioXponent.leds.loopIn, value); +}; -MaudioXponent.loopin = function(channel, control, value, status) { - var deck = MaudioXponent.state.deck[channel]; - engine.setValue(deck.group, "loop_in", 1); +MaudioXponent.loopout = function(channel, control, value, status, group) { + var deck = MaudioXponent.getDeck(group); + engine.setValue(deck.group, "loop_out", !deck.shift); }; -MaudioXponent.loopout = function(channel, control, value, status) { - // TODO: Can we use the channel passed in? - var deck = MaudioXponent.state.deck[channel]; - engine.setValue(deck.group, "loop_out", 1); +MaudioXponent.onLoopOut = function(value, group, control) { + var deck = MaudioXponent.getDeck(group); + midi.sendShortMsg(deck.on, MaudioXponent.leds.loopOut, value); }; -MaudioXponent.loopexit = function(channel, control, value, status) { - // TODO: Can we use the channel passed in? - var deck = MaudioXponent.state.deck[channel]; +MaudioXponent.loopexit = function(channel, control, value, status, group) { + var deck = MaudioXponent.getDeck(group); engine.setValue(deck.group, "reloop_exit", 1); }; -MaudioXponent.punchIn = function(channel, control, value, status) { - // TODO: Can we use the channel passed in? - var deck = MaudioXponent.state.deck[channel]; - var activate = (status == deck.on); - - if (activate) { - MaudioXponent.state.faderPosition = faderPosition = engine.getValue("[Master]", "crossfader"); - - if ((faderPosition >= 0.90 && channel == 0) || (faderPosition <= -0.90 && channel == 1)) { - midi.sendShortMsg(deck.on,control,0x01); - engine.setValue("[Master]", "crossfader", 0); - } - } else { - engine.setValue("[Master]", "crossfader", MaudioXponent.state.faderPosition); - midi.sendShortMsg(deck.on, control, 0x00); - } -}; +MaudioXponent.onLoopExit = function(value, group, control) { + var deck = MaudioXponent.getDeck(group); + midi.sendShortMsg(deck.on, MaudioXponent.leds.loop, engine.getValue(group, control) == 1); +} MaudioXponent.pitch = function(channel, control, value, status, group) { engine.setValue(group, "rate", script.midiPitch(control, value, status)); }; -MaudioXponent.secondaryon = function(channel, control, value, status) { - // TODO: Can we use the channel passed in? - var deck = MaudioXponent.state.deck[channel]; - deck.shift = true; - midi.sendShortMsg(deck.on, control, 0x01); -}; - -MaudioXponent.secondaryoff = function(channel, control, value, status) { - // TODO: Can we use the channel passed in? - var deck = MaudioXponent.state.deck[channel]; - deck.shift = false; - midi.sendShortMsg(deck.on,control,0x00); +MaudioXponent.shift = function(channel, control, value, status, group) { + // script.midiDebug(channel, control, value, status, group); + var deck = MaudioXponent.getDeck(group); + deck.shift = (status === deck.on); + midi.sendShortMsg(deck.on, MaudioXponent.leds.shift, deck.shift); }; -MaudioXponent.toggleScratchMode = function(channel, control, value, status) { - script.midiDebug(channel, control, value, status); - var deck = MaudioXponent.state.deck[channel]; - +MaudioXponent.toggleScratchMode = function(channel, control, value, status, group) { + //script.midiDebug(channel, control, value, status, group); + var deck = MaudioXponent.getDeck(group); deck.scratchEnabled = !deck.scratchEnabled; - midi.sendShortMsg(deck.on, control, deck.scratchEnabled); + midi.sendShortMsg(deck.on, MaudioXponent.leds.scratch, deck.scratchEnabled); }; -MaudioXponent.playlist = function(channel, control, value, status) { - var deck = MaudioXponent.state.deck[channel]; +MaudioXponent.playlist = function(channel, control, value, status, group) { + var deck = MaudioXponent.getDeck(group); switch (control) { case 28: - midi.sendShortMsg(deck.on,control,0x01); // Turn on the LED - engine.setValue("[Playlist]", "SelectPrevTrack",1); + engine.setValue("[Playlist]", "SelectPrevTrack", 1); + midi.sendShortMsg(deck.on, control, true); break; case 29: - midi.sendShortMsg(deck.on,control,0x01); // Turn on the LED - engine.setValue("[Playlist]", "SelectNextTrack",1); + engine.setValue("[Playlist]", "SelectNextTrack", 1); + midi.sendShortMsg(deck.on, control, true); break; case 30: - midi.sendShortMsg(deck.on,control,0x01); // Turn on the LED var activenow = engine.getValue(deck.group, "play"); if (activenow == 1) { // If currently active - engine.setValue("[Playlist]", "LoadSelectedIntoFirstStopped",1); - }else{ - engine.setValue(deck.group, "LoadSelectedTrack",1); + engine.setValue("[Playlist]", "LoadSelectedIntoFirstStopped", 1); + } else { + engine.setValue(deck.group, "LoadSelectedTrack", 1); } + midi.sendShortMsg(deck.on, control, true); break; case 31: - midi.sendShortMsg(deck.on,control,0x01); // Turn on the LED - engine.setValue("[Playlist]", "SelectPrevPlaylist",1); + engine.setValue("[Playlist]", "SelectPrevPlaylist", 1); + midi.sendShortMsg(deck.on, control, true); break; case 32: - midi.sendShortMsg(deck.on,control,0x01); // Turn on the LED - engine.setValue("[Playlist]", "SelectNextPlaylist",1); + engine.setValue("[Playlist]", "SelectNextPlaylist", 1); + midi.sendShortMsg(deck.on, control, true); break; } }; -MaudioXponent.playlistoff = function(channel, control, value, status) { - var deck = MaudioXponent.state.deck[channel]; - midi.sendShortMsg(deck.off, control, 0x00); -}; - -MaudioXponent.onKeyLock = function(value, group) { +MaudioXponent.playlistoff = function(channel, control, value, status, group) { var deck = MaudioXponent.getDeck(group); - - if (value) { - midi.sendShortMsg(deck.on, 0x1E, 0x01) - } else { - midi.sendShortMsg(deck.off, 0x1E, 0x00) - } + midi.sendShortMsg(deck.on, control, false); }; -MaudioXponent.toggleKeylock = function(channel, control, value, status) { +MaudioXponent.keyLock = function(channel, control, value, status, group) { //script.midiDebug(channel, control, value, status); - var deck = MaudioXponent.state.deck[channel]; + var deck = MaudioXponent.getDeck(group); if (!deck.shift) { // Unshifted = Keylock @@ -487,78 +675,63 @@ MaudioXponent.toggleKeylock = function(channel, control, value, status) { } }; -MaudioXponent.brake = function(channel, control, value, status) { - //script.midiDebug(channel, control, value, status); - var deck = MaudioXponent.state.deck[channel]; - var activate = (status == deck.on); - - if (activate) { - engine.brake(deck.id, true); - } else { - engine.brake(deck.id, false) - } -}; - -MaudioXponent.cuedefon = function(channel, control, value, status) { - //script.midiDebug(channel, control, value, status); - var deck = MaudioXponent.state.deck[channel]; - engine.setValue(deck.group, "cue_default",1); - midi.sendShortMsg(deck.on, control, 0x01); +MaudioXponent.onkeyLock = function(value, group) { + var deck = MaudioXponent.getDeck(group); + midi.sendShortMsg(deck.on, MaudioXponent.leds.key, value); }; -MaudioXponent.cuedefoff = function(channel, control, value, status) { - //script.midiDebug(channel, control, value, status); - var deck = MaudioXponent.state.deck[channel]; - engine.setValue(deck.group, "cue_default",0); - midi.sendShortMsg(deck.off, control, 0x00); +MaudioXponent.brake = function(channel, control, value, status, group) { + //script.midiDebug(channel, control, value, status, group); + var deck = MaudioXponent.getDeck(group); + var activate = (status == deck.on); + engine.brake(deck.id, activate); }; -MaudioXponent.volbuttonon = function(channel, control, value, status) { +MaudioXponent.cue = function(channel, control, value, status, group) { //script.midiDebug(channel, control, value, status); - var deck = MaudioXponent.state.deck[channel]; - engine.setValue(deck.group, "volume",0); - midi.sendShortMsg(deck.on,control,0x01); + var deck = MaudioXponent.getDeck(group); + var activate = (status == deck.on); + engine.setValue(deck.group, "cue_default", activate); + + //TODO: Is this needed? + midi.sendShortMsg(deck.on, control, activate); }; -MaudioXponent.volbuttonoff = function(channel, control, value, status) { +MaudioXponent.play = function(channel, control, value, status, group) { //script.midiDebug(channel, control, value, status); - var deck = MaudioXponent.state.deck[channel]; - engine.setValue(deck.group, "volume",1); - midi.sendShortMsg(deck.off, control, 0x00); + var deck = MaudioXponent.getDeck(group); + var activate = (status == deck.on); + if (activate) { + var playing = engine.getValue(group, "play"); + engine.setValue(deck.group, "play", !playing); + } }; -MaudioXponent.shutdown = function (id) { // called when the MIDI device is closed - // TODO: How does 4-deck mode affect this? - for (var led in MaudioXponent.leds) { - midi.sendShortMsg(MaudioXponent.on,MaudioXponent.leds[led],0x00); - midi.sendShortMsg(MaudioXponent.on + 1,MaudioXponent.leds[led],0x00); - } - midi.sendShortMsg(0xB3,0x14,0x00); - midi.sendShortMsg(0xB3,0x15,0x00); - - midi.sendSysexMsg(MaudioXponent.Handshake3, MaudioXponent.Handshake3.length); +MaudioXponent.onPlay = function(value, group, control) { + var deck = MaudioXponent.getDeck(group); + midi.sendShortMsg(deck.on, MaudioXponent.leds[control], value); }; -MaudioXponent.beatgridAdjust = function(channel, control, value, status) { - //script.midiDebug(channel, control, value, status); - var deck = MaudioXponent.state.deck[channel]; +MaudioXponent.beatgridAdjust = function(channel, control, value, status, group) { + //script.midiDebug(channel, control, value, status, group); + var deck = MaudioXponent.getDeck(group); - if (!deck.shift) { + if (deck.shift) { + // Shifted = align + engine.setValue(deck.group, "beats_translate_curpos", 1); + } else { // Unshifted = earlier / later if (control == MaudioXponent.leds.leftkey){ engine.setValue(deck.group, "beats_translate_earlier", 1); } else { engine.setValue(deck.group, "beats_translate_later", 1); } - } else { - // Shifted = align - engine.setValue(deck.group, "beats_translate_curpos", 1); } }; MaudioXponent.beatgridLoop = function(channel, control, value, status, group) { - //script.midiDebug(channel, control, value, status, group); - var deck = MaudioXponent.state.deck[channel]; + // script.midiDebug(channel, control, value, status, group); + var deck = MaudioXponent.getDeck(group); var activate = (status == deck.on); var length = Math.pow(2, control - 0x25); @@ -570,105 +743,103 @@ MaudioXponent.beatgridLoop = function(channel, control, value, status, group) { if (activate) { engine.setValue(group, "beatlooproll_" + 1.0 / length + "_activate", value); } else { - //print ("Exit rolling beat loop"); - MaudioXponent.loopexit(channel, control, value, status) + MaudioXponent.loopexit(channel, control, value, status, group); } } }; -MaudioXponent.beatsync = function(channel, control, value, status) { - //script.midiDebug(channel, control, value, status); - var deck = MaudioXponent.state.deck[channel]; +MaudioXponent.onTrackLoaded = function(duration, group) { + var deck = MaudioXponent.getDeck(group); + deck.warnAt = (duration - 30) / parseFloat(duration); +}; - if (!deck.shift) { - engine.setValue(deck.group, "beatsync", 1); - } else { - engine.setValue(deck.group, "bpm_tap", 1); - } +MaudioXponent.nudge = function(channel, control, value, status, group) { + //script.midiDebug(channel, control, value, status, group); + var deck = MaudioXponent.getDeck(group); + var activate = (status === deck.on); + engine.setValue(group, MaudioXponent.binleds[control], activate); }; -MaudioXponent.fx = function(channel, control, value, status) { - //script.midiDebug(channel, control, value, status); - var deck = MaudioXponent.state.deck[channel]; - var currentControl = control - 0x0B; - var isKnob = (status == 0xB1); +MaudioXponent.onNudge = function(value, group, control) { + var deck = MaudioXponent.getDeck(group); + midi.sendShortMsg(deck.on, MaudioXponent.leds[control], value); +}; - if (isKnob) { - if(MaudioXponent.state.focusedEffect != 0) { - var group = "[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffect + "_Effect1]"; - var scaledValue = value / 0x7F; +MaudioXponent.pfl = function(channel, control, value, status, group) { + //script.midiDebug(channel, control, value, status, group); + var deck = MaudioXponent.getDeck(group); + var activate = (status == deck.on); - if (currentControl == 4) { - // Wet / Dry - //print("Group " + group + ", parameter = " + currentControl + ", value = " + scaledValue); - engine.setParameter("[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffect + "]", "mix", scaledValue); - } else { - // Other parameter - //print("Group " + group + ", parameter = " + currentControl + ", value = " + scaledValue); - engine.setParameter(group, "parameter" + currentControl, scaledValue); + if (activate) { + if (MaudioXponent.leftDeck.shift && MaudioXponent.rightDeck.shift) { + // Double-shift = cycle modes + var mode = MaudioXponent.config.pflMode + 1; + if(mode === 2){ + mode = 0; } - } - } else { - var group = "[EffectRack1_EffectUnit" + currentControl + "]"; - // print("Button " + group + ", MaudioXponent.state.focusedEffect=" + MaudioXponent.state.focusedEffect); - - if (deck.shift) { - // Cycle effects - engine.setValue(group, "next_chain", 1); + MaudioXponent.config.pflMode = mode; } else { - if (currentControl == MaudioXponent.state.focusedEffect) { - // Toggle enabled - var effectEnabled = engine.getValue(group, "enabled"); - if (effectEnabled) { - engine.setValue(group, "enabled", 0); - } else { - engine.setValue(group, "enabled", 1); - } - } else { - // Change focus - MaudioXponent.state.focusedEffect = currentControl; + for (i = 1; i <= MaudioXponent.decks.length; i++) { + var grp = "[Channel" + i + "]"; + if (grp === group) { + engine.setValue(grp, "pfl", !engine.getValue(grp, "pfl")); + } else if (MaudioXponent.config.pflMode == 1) { + engine.setValue(grp, "pfl", 0); + } } + } + } +}; - // Light the focused effect - for (i = 0; i < 4; i++) { - var ctrl = MaudioXponent.leds.fx1 + i; - var fxNum = i + 1; - var newValue = (fxNum == MaudioXponent.state.focusedEffect) ? 1 : 0; +MaudioXponent.onPflChanged = function(value, group) { + var deck = MaudioXponent.getDeck(group); + midi.sendShortMsg(deck.on, MaudioXponent.leds.pfl, value); +}; - //print("fxNum = " + fxNum + ", channel = " + channel + ", ctrl = 0x0" + ctrl.toString(16) + ", newValue = " + newValue); - midi.sendShortMsg(deck.on, ctrl, newValue); - } - } +MaudioXponent.reverse = function(channel, control, value, status, group) { + // script.midiDebug(channel, control, value, status, group); + var deck = MaudioXponent.getDeck(group); + var activate = (status == deck.on) ? 1 : 0; + if (deck.shift) { + // Reverse rolling + engine.setValue(group, "reverseroll", activate); + } else { + // Normal + engine.setValue(group, "reverse", activate); } }; -MaudioXponent.onTrackLoaded = function(duration, group) { +MaudioXponent.onReverse = function(value, group, control) { var deck = MaudioXponent.getDeck(group); - deck.warnAt = (duration - 30) / parseFloat(duration); + midi.sendShortMsg(deck.on, MaudioXponent.leds[control], value); }; -MaudioXponent.nudge = function (channel, control, value, status, group) { - //script.midiDebug(channel, control, value, status, group); - var deck = MaudioXponent.state.deck[channel]; - var controlName = ((control == 0x10 && MaudioXponent.config.nudgeButtonMode == 0) || (control != 0x10 && MaudioXponent.config.nudgeButtonMode == 1)) - ? "rate_temp_down" - : "rate_temp_up"; +MaudioXponent.seek = function(channel, control, value, status, group) { + var deck = MaudioXponent.getDeck(group); var activate = (status == deck.on); - engine.setValue(group, controlName, activate); + engine.setValue(group, MaudioXponent.binleds[control], activate); }; -MaudioXponent.pfl = function(channel, control, value, status) { - //script.midiDebug(channel, control, value, status); - var numDecks = engine.getValue("[Master]", "num_decks"); +MaudioXponent.sampler = function(channel, control, value, status, group) { + // script.midiDebug(channel, control, value, status, group); + var shifted = MaudioXponent.decks[0].shift || MaudioXponent.decks[2].shift; + if (shifted) { + engine.setValue(group, "cue_gotoandstop", 1); + } else { + engine.setValue(group, "cue_gotoandplay", 1); + } +}; - for (i = 1; i <= numDecks; i++) { - var group = "[Channel" + i + "]"; - var currentValue = engine.getValue(group, "pfl"); +MaudioXponent.onSampler = function(value, group, control) { + var samplerNumber = parseInt(group.substring(8)); + var led = MaudioXponent.leds.fx1 + samplerNumber - 1; + midi.sendShortMsg(MaudioXponent.on, led, value); + midi.sendShortMsg(MaudioXponent.on + 5, led, value); +}; - if (i == channel + 1) { - engine.setValue(group, "pfl", !currentValue); - } else if (MaudioXponent.config.pflMode == 1) { - engine.setValue(group, "pfl", 0); - } +MaudioXponent.onEject = function(value, group, control) { + if (value) { + engine.setValue(group, "playposition", 0); + MaudioXponent.onPlayPositionChange(null, group); } -} \ No newline at end of file +}; \ No newline at end of file From 4587eef805a33eab0a1cdd71225e0097caca5bd5 Mon Sep 17 00:00:00 2001 From: Mel Grubb Date: Sun, 26 Feb 2017 22:23:01 -0500 Subject: [PATCH 05/20] Reverted nudge button mode to standard by default. --- res/controllers/M-Audio-Xponent-Advanced-scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/controllers/M-Audio-Xponent-Advanced-scripts.js b/res/controllers/M-Audio-Xponent-Advanced-scripts.js index 667f8033a5d4..1a9983014847 100644 --- a/res/controllers/M-Audio-Xponent-Advanced-scripts.js +++ b/res/controllers/M-Audio-Xponent-Advanced-scripts.js @@ -14,7 +14,7 @@ MaudioXponent.Handshake2 = [0xF0,0x00,0x20,0x08,0x00,0x00,0x63,0x0E,0x16,0x40,0x MaudioXponent.Handshake3 = [0xF0,0x00,0x20,0x08,0x00,0x00,0x63,0x0E,0x16,0x40,0x00,0x00,0xF7]; MaudioXponent.config = { - nudgeButtonMode : 1, // 0 = Normal, 1 = Reversed + nudgeButtonMode : 0, // 0 = Normal, 1 = Reversed pflMode : 0, // 0 = Independent, 1 = Toggle syncFlashMode : 0, // 0 = Off, 1 = Pulse, 2 = Toggle vuMeterMode : 1, // 0 = Master, 1 = Channel From ebcab77ce37f6957e3b0c45948929eac65591ff4 Mon Sep 17 00:00:00 2001 From: Mel Grubb Date: Thu, 2 Mar 2017 22:00:15 -0500 Subject: [PATCH 06/20] Changed play to play_indicator where appropriate. Eliminated midi message to control cue light, the XML handles this. --- .../M-Audio-Xponent-Advanced-scripts.js | 163 +++++++++--------- 1 file changed, 80 insertions(+), 83 deletions(-) diff --git a/res/controllers/M-Audio-Xponent-Advanced-scripts.js b/res/controllers/M-Audio-Xponent-Advanced-scripts.js index 1a9983014847..035be79a22ec 100644 --- a/res/controllers/M-Audio-Xponent-Advanced-scripts.js +++ b/res/controllers/M-Audio-Xponent-Advanced-scripts.js @@ -1,7 +1,7 @@ function MaudioXponent () {} // ---------- Global variables ---------- -MaudioXponent.id = ""; // The ID for the particular device being controlled for use in debugging, set at init time +MaudioXponent.id = ""; // The ID for the particular device being controlled for use in debugging, set at init time MaudioXponent.on = 0x90; MaudioXponent.off = 0x80; MaudioXponent.maxDecks = 0x04; @@ -20,24 +20,24 @@ MaudioXponent.config = { vuMeterMode : 1, // 0 = Master, 1 = Channel } -MaudioXponent.decks = +MaudioXponent.decks = [ { noteOffset : 0, on : 0x90, off : 0x80, isLeft : true, isRight : false, isBankA : true, isBankB : false }, { noteOffset : 1, on : 0x91, off : 0x81, isLeft : false, isRight : true, isBankA : true, isBankB : false }, { noteOffset : 5, on : 0x95, off : 0x85, isLeft : true, isRight : false, isBankA : false, isBankB : true }, - { noteOffset : 6, on : 0x96, off : 0x86, isLeft : false, isRight : true, isBankA : false, isBankB : true } + { noteOffset : 6, on : 0x96, off : 0x86, isLeft : false, isRight : true, isBankA : false, isBankB : true }, ]; MaudioXponent.state = { bank : 0, // Which position is the bank switch currently set to? faderPosition : 0, // Temporary storage for cross-fader position during punch-ins. focusedEffect : 0, - plnumberpos : 0, + plnumberpos : 0, plnumberneg : 0, }; -MaudioXponent.leds = { - "play": 0x24, +MaudioXponent.buttons = { + "play_indicator": 0x24, "cue": 0x23, "back": 0x21, "fwd": 0x22, @@ -133,13 +133,13 @@ MaudioXponent.initDecks = function() { deck.filterMid = 1; deck.filterHigh = 1; deck.pregain = 1; - - engine.connectControl(group, "play", "MaudioXponent.onPlay"); + + engine.connectControl(group, "play_indicator", "MaudioXponent.onPlay"); engine.connectControl(group, "playposition", "MaudioXponent.onPlayPositionChange"); engine.connectControl(group, "duration", "MaudioXponent.onTrackLoaded"); engine.connectControl(group, "beat_active", "MaudioXponent.onBeatActive"); engine.connectControl(group, "eject", "MaudioXponent.onEject"); - + for (i = 1; i <= 5; i++) { engine.connectControl(group, "hotcue_" + i + "_enabled", "MaudioXponent.onHotCue"); } @@ -158,7 +158,7 @@ MaudioXponent.initDecks = function() { engine.connectControl(group, "reverse", "MaudioXponent.onReverse"); engine.connectControl(group, "reverseroll", "MaudioXponent.onReverse"); engine.connectControl(group, "rate_temp_down", "MaudioXponent.onNudge"); - engine.connectControl(group, "rate_temp_up", "MaudioXponent.onNudge"); + engine.connectControl(group, "rate_temp_up", "MaudioXponent.onNudge"); engine.connectControl("[EqualizerRack1_" + group + "_Effect1]", "button_parameter1", "MaudioXponent.onFilterKill"); engine.connectControl("[EqualizerRack1_" + group + "_Effect1]", "button_parameter2", "MaudioXponent.onFilterKill"); @@ -175,7 +175,7 @@ MaudioXponent.initDecks = function() { for (i = 1; i <=4; i++) { var group = "[Sampler" + i + "]"; - engine.connectControl(group, "play", "MaudioXponent.onSampler"); + engine.connectControl(group, "play_indicator", "MaudioXponent.onSampler"); } // Effects parameters... not working in Mixxx 2.0, should work in 2.1 @@ -194,8 +194,8 @@ MaudioXponent.initDecks = function() { MaudioXponent.probeLights = function() { var status = 0xB4; // for(status = 0xB0; status < 0xC0; status++) { - for (var led in MaudioXponent.leds) { - var byte2 = MaudioXponent.leds[led]; + for (var led in MaudioXponent.buttons) { + var byte2 = MaudioXponent.buttons[led]; // for(byte2 = 0; byte2 < 128; byte2++) { for(byte3 = 0; byte3 < 128; byte3++) { midi.sendShortMsg(status, byte2, byte3); @@ -206,22 +206,22 @@ MaudioXponent.probeLights = function() { }; MaudioXponent.initLights = function () { - // Enable lights - midi.sendSysexMsg(MaudioXponent.Handshake1, MaudioXponent.Handshake1.length); - midi.sendSysexMsg(MaudioXponent.Handshake2, MaudioXponent.Handshake2.length); + // Enable lights + midi.sendSysexMsg(MaudioXponent.Handshake1, MaudioXponent.Handshake1.length); + midi.sendSysexMsg(MaudioXponent.Handshake2, MaudioXponent.Handshake2.length); - for (var led in MaudioXponent.leds) { - midi.sendShortMsg(MaudioXponent.leftDeck.on, MaudioXponent.leds[led], 0x01); - midi.sendShortMsg(MaudioXponent.rightDeck.on, MaudioXponent.leds[led], 0x01); + for (var led in MaudioXponent.buttons) { + midi.sendShortMsg(MaudioXponent.leftDeck.on, MaudioXponent.buttons[led], 0x01); + midi.sendShortMsg(MaudioXponent.rightDeck.on, MaudioXponent.buttons[led], 0x01); MaudioXponent.pauseScript(15); } - + for(i = 0; i <= 10; i += 1) { - var value = MaudioXponent.convert(i * .1); + var value = MaudioXponent.convert(i * 0.1); // VU meters midi.sendShortMsg(MaudioXponent.leftDeck.vuMeterStatusByte, MaudioXponent.leftDeck.vuMeterSecondByte, value); midi.sendShortMsg(MaudioXponent.rightDeck.vuMeterStatusByte, MaudioXponent.rightDeck.vuMeterSecondByte, value); - + // Progress meters midi.sendShortMsg(MaudioXponent.leftDeck.progressMeterStatusByte, MaudioXponent.leftDeck.progressMeterSecondByte, value); midi.sendShortMsg(MaudioXponent.rightDeck.progressMeterStatusByte, MaudioXponent.rightDeck.progressMeterSecondByte, value); @@ -231,49 +231,49 @@ MaudioXponent.initLights = function () { MaudioXponent.pauseScript(500); - for (var led in MaudioXponent.leds) { - midi.sendShortMsg(MaudioXponent.on, MaudioXponent.leds[led], 0x00); - midi.sendShortMsg(MaudioXponent.on + 1, MaudioXponent.leds[led], 0x00); + for (var led in MaudioXponent.buttons) { + midi.sendShortMsg(MaudioXponent.on, MaudioXponent.buttons[led], 0x00); + midi.sendShortMsg(MaudioXponent.on + 1, MaudioXponent.buttons[led], 0x00); MaudioXponent.pauseScript(15); } // VU meters midi.sendShortMsg(MaudioXponent.leftDeck.vuMeterStatusByte, MaudioXponent.leftDeck.vuMeterSecondByte, 0); midi.sendShortMsg(MaudioXponent.rightDeck.vuMeterStatusByte, MaudioXponent.rightDeck.vuMeterSecondByte, 0); - + // Progress meters midi.sendShortMsg(MaudioXponent.leftDeck.progressMeterStatusByte, MaudioXponent.leftDeck.progressMeterSecondByte, 0); midi.sendShortMsg(MaudioXponent.rightDeck.progressMeterStatusByte, MaudioXponent.rightDeck.progressMeterSecondByte, 0); }; MaudioXponent.shutdown = function (id) { - for (var led in MaudioXponent.leds) { - midi.sendShortMsg(MaudioXponent.on, MaudioXponent.leds[led], 0x00); - midi.sendShortMsg(MaudioXponent.on + 1,MaudioXponent.leds[led], 0x00); + for (var led in MaudioXponent.buttons) { + midi.sendShortMsg(MaudioXponent.on, MaudioXponent.buttons[led], 0x00); + midi.sendShortMsg(MaudioXponent.on + 1,MaudioXponent.buttons[led], 0x00); } // VU meters midi.sendShortMsg(MaudioXponent.leftDeck.vuMeterStatusByte, MaudioXponent.leftDeck.vuMeterSecondByte, 0); midi.sendShortMsg(MaudioXponent.rightDeck.vuMeterStatusByte, MaudioXponent.rightDeck.vuMeterSecondByte, 0); - + // Progress meters midi.sendShortMsg(MaudioXponent.leftDeck.progressMeterStatusByte, MaudioXponent.leftDeck.progressMeterSecondByte, 0); midi.sendShortMsg(MaudioXponent.rightDeck.progressMeterStatusByte, MaudioXponent.rightDeck.progressMeterSecondByte, 0); // Secret Handshake - midi.sendSysexMsg(MaudioXponent.Handshake3, MaudioXponent.Handshake3.length); + midi.sendSysexMsg(MaudioXponent.Handshake3, MaudioXponent.Handshake3.length); }; MaudioXponent.syncLights = function() { for (i = 0; i < MaudioXponent.decks.length; i++) { var deck = MaudioXponent.decks[i]; - engine.trigger(deck.group, "play"); + engine.trigger(deck.group, "play_indicator"); engine.trigger(deck.group, "pfl"); engine.trigger(deck.group, "loop_enabled"); engine.trigger(deck.group, "loop_start_position"); engine.trigger(deck.group, "loop_end_position"); - + engine.trigger("[EqualizerRack1_" + deck.group + "_Effect1]", "button_parameter1"); engine.trigger("[EqualizerRack1_" + deck.group + "_Effect1]", "button_parameter2"); engine.trigger("[EqualizerRack1_" + deck.group + "_Effect1]", "button_parameter3"); @@ -288,7 +288,7 @@ MaudioXponent.syncLights = function() { engine.trigger(deck.group, "loop_in"); engine.trigger(deck.group, "loop_out"); - midi.sendShortMsg(deck.on, MaudioXponent.leds.scratch, deck.scratchEnabled); + midi.sendShortMsg(deck.on, MaudioXponent.buttons.scratch, deck.scratchEnabled); MaudioXponent.onPlayPositionChange(deck.playPosition, deck.group); } }; @@ -313,9 +313,9 @@ MaudioXponent.vuMeter = function(mode, bank, side, value) { value = MaudioXponent.convert(value); if (side === 0) { - midi.sendShortMsg(MaudioXponent.leftDeck.vuMeterStatusByte, MaudioXponent.leftDeck.vuMeterSecondByte, value); + midi.sendShortMsg(MaudioXponent.leftDeck.vuMeterStatusByte, MaudioXponent.leftDeck.vuMeterSecondByte, value); } else { - midi.sendShortMsg(MaudioXponent.rightDeck.vuMeterStatusByte, MaudioXponent.rightDeck.vuMeterSecondByte, value); + midi.sendShortMsg(MaudioXponent.rightDeck.vuMeterStatusByte, MaudioXponent.rightDeck.vuMeterSecondByte, value); } } } @@ -358,7 +358,7 @@ MaudioXponent.beatsync = function(channel, control, value, status, group) { } } - midi.sendShortMsg(deck.on, MaudioXponent.leds.sync, activate); + midi.sendShortMsg(deck.on, MaudioXponent.buttons.sync, activate); }; MaudioXponent.punchIn = function(channel, control, value, status, group) { @@ -376,7 +376,7 @@ MaudioXponent.punchIn = function(channel, control, value, status, group) { engine.setValue("[Master]", "crossfader", MaudioXponent.state.faderPosition); } - midi.sendShortMsg(deck.on, MaudioXponent.leds.punchIn, activate); + midi.sendShortMsg(deck.on, MaudioXponent.buttons.punchIn, activate); }; MaudioXponent.filterKill = function(channel, control, value, status, group) { @@ -384,7 +384,7 @@ MaudioXponent.filterKill = function(channel, control, value, status, group) { var deck = MaudioXponent.getDeck(group); var activate = (status == deck.on); - if (control === MaudioXponent.leds.gain) { + if (control === MaudioXponent.buttons.gain) { // Gain Buttons if (activate && (MaudioXponent.leftDeck.shift && MaudioXponent.rightDeck.shift)) { //Double-shift = cycle modes @@ -403,18 +403,18 @@ MaudioXponent.filterKill = function(channel, control, value, status, group) { engine.setValue(deck.group, "volume", deck.volume); } - midi.sendShortMsg(deck.on, MaudioXponent.leds.gain, activate); + midi.sendShortMsg(deck.on, MaudioXponent.buttons.gain, activate); } } else { // Low/Mid/High Buttons, momentary kill var group = "[EqualizerRack1_" + deck.group + "_Effect1]"; - engine.setValue(group, MaudioXponent.binleds[control], activate); + engine.setValue(group, MaudioXponent.buttons[control], activate); } }; MaudioXponent.onFilterKill = function(value, group, control) { var deck = MaudioXponent.decks[parseInt(group.substring(24)) - 1]; - midi.sendShortMsg(deck.on, MaudioXponent.leds[control], value); + midi.sendShortMsg(deck.on, MaudioXponent.buttons[control], value); }; MaudioXponent.effectButton = function(channel, control, value, status, group) { @@ -434,7 +434,7 @@ MaudioXponent.effectButton = function(channel, control, value, status, group) { engine.setValue(group, "enabled", 0); } else { engine.setValue(group, "enabled", 1); - } + } } else { // Change focus MaudioXponent.state.focusedEffect = currentControl; @@ -442,7 +442,7 @@ MaudioXponent.effectButton = function(channel, control, value, status, group) { // Light the focused effect for (i = 0; i < 4; i++) { - var ctrl = MaudioXponent.leds.fx1 + i; + var ctrl = MaudioXponent.buttons.fx1 + i; var fxNum = i + 1; var newValue = (fxNum == MaudioXponent.state.focusedEffect) ? 1 : 0; midi.sendShortMsg(deck.on, ctrl, newValue); @@ -471,7 +471,7 @@ MaudioXponent.effectParameter = function(channel, control, value, status, group) MaudioXponent.wheel = function (channel, control, value, status, group) { var deck = MaudioXponent.getDeck(group); - + if (deck.shift) { if (value > 64) { MaudioXponent.state["plnumberpos"]++; @@ -482,11 +482,11 @@ MaudioXponent.wheel = function (channel, control, value, status, group) { MaudioXponent.state["plnumberneg"]++; if (MaudioXponent.state["plnumberneg"] % 12 == 0) { engine.setValue("[Playlist]", "SelectTrackKnob", -1); - } + } } } else { if (deck.scratching) { - engine.scratchTick(deck.id, value - 64); + engine.scratchTick(deck.id, value - 64); } else { engine.setValue(group, "jog", (value - 64) / 8); } @@ -497,7 +497,7 @@ MaudioXponent.wheelTouch = function(channel, control, value, status, group) { //script.midiDebug(channel, control, value, status, group) var deck = MaudioXponent.getDeck(group); var activate = (status == deck.on); - + if (activate) { if (deck.scratchEnabled) { engine.scratchEnable(deck.id, 3 * 128, 33 + 1/3, 1.0/8, (1.0/8)/32); @@ -506,21 +506,21 @@ MaudioXponent.wheelTouch = function(channel, control, value, status, group) { } else { engine.scratchDisable (deck.id); deck.scratching = false; - } + } }; MaudioXponent.onBeatActive = function(value, group) { var deck = MaudioXponent.getDeck(group); if (MaudioXponent.config.syncFlashMode === 1) { - midi.sendShortMsg(deck.on, MaudioXponent.leds.sync, value); + midi.sendShortMsg(deck.on, MaudioXponent.buttons.sync, value); } - + if (value) { deck.beatState = !deck.beatState; - + if (MaudioXponent.config.syncFlashMode === 2) { - midi.sendShortMsg(deck.on, MaudioXponent.leds.sync, deck.beatState); + midi.sendShortMsg(deck.on, MaudioXponent.buttons.sync, deck.beatState); } } }; @@ -528,7 +528,7 @@ MaudioXponent.onBeatActive = function(value, group) { MaudioXponent.onBeatLoop = function(value, group, control) { var deck = MaudioXponent.getDeck(group); var offset = Math.log(parseInt(control.substring(9))) / Math.log(2) - midi.sendShortMsg(deck.on, MaudioXponent.leds.loop1, value); + midi.sendShortMsg(deck.on, MaudioXponent.buttons.loop1, value); }; MaudioXponent.onBpmChanged = function(value, group) { @@ -538,14 +538,14 @@ MaudioXponent.onBpmChanged = function(value, group) { MaudioXponent.onPlayPositionChange = function(value, group) { var deck = MaudioXponent.getDeck(group); var status = MaudioXponent.bank - + value = engine.getValue(group, "playposition"); deck.playPosition = value; if ((value < deck.warnAt) || (!engine.getValue(group, "play")) || (value >= deck.warnAt && deck.beatState)) { midi.sendShortMsg(deck.progressMeterStatusByte, deck.progressMeterSecondByte, MaudioXponent.convert(value)); } else { - midi.sendShortMsg(deck.progressMeterStatusByte, deck.progressMeterSecondByte, 0x00); + midi.sendShortMsg(deck.progressMeterStatusByte, deck.progressMeterSecondByte, 0x00); } }; @@ -565,7 +565,7 @@ MaudioXponent.hotcue = function(channel, control, value, status, group) { MaudioXponent.onHotCue = function(value, group, control) { var deck = MaudioXponent.getDeck(group); var cueNumber = parseInt(control.substring(7)) - 1; - midi.sendShortMsg(deck.on, MaudioXponent.leds.cue1 + cueNumber, value); + midi.sendShortMsg(deck.on, MaudioXponent.buttons.cue1 + cueNumber, value); }; MaudioXponent.loopin = function(channel, control, value, status, group) { @@ -575,7 +575,7 @@ MaudioXponent.loopin = function(channel, control, value, status, group) { MaudioXponent.onLoopIn = function(value, group, control) { var deck = MaudioXponent.getDeck(group); - midi.sendShortMsg(deck.on, MaudioXponent.leds.loopIn, value); + midi.sendShortMsg(deck.on, MaudioXponent.buttons.loopIn, value); }; MaudioXponent.loopout = function(channel, control, value, status, group) { @@ -585,7 +585,7 @@ MaudioXponent.loopout = function(channel, control, value, status, group) { MaudioXponent.onLoopOut = function(value, group, control) { var deck = MaudioXponent.getDeck(group); - midi.sendShortMsg(deck.on, MaudioXponent.leds.loopOut, value); + midi.sendShortMsg(deck.on, MaudioXponent.buttons.loopOut, value); }; MaudioXponent.loopexit = function(channel, control, value, status, group) { @@ -595,7 +595,7 @@ MaudioXponent.loopexit = function(channel, control, value, status, group) { MaudioXponent.onLoopExit = function(value, group, control) { var deck = MaudioXponent.getDeck(group); - midi.sendShortMsg(deck.on, MaudioXponent.leds.loop, engine.getValue(group, control) == 1); + midi.sendShortMsg(deck.on, MaudioXponent.buttons.loop, engine.getValue(group, control) == 1); } MaudioXponent.pitch = function(channel, control, value, status, group) { @@ -606,14 +606,14 @@ MaudioXponent.shift = function(channel, control, value, status, group) { // script.midiDebug(channel, control, value, status, group); var deck = MaudioXponent.getDeck(group); deck.shift = (status === deck.on); - midi.sendShortMsg(deck.on, MaudioXponent.leds.shift, deck.shift); + midi.sendShortMsg(deck.on, MaudioXponent.buttons.shift, deck.shift); }; MaudioXponent.toggleScratchMode = function(channel, control, value, status, group) { //script.midiDebug(channel, control, value, status, group); - var deck = MaudioXponent.getDeck(group); + var deck = MaudioXponent.getDeck(group); deck.scratchEnabled = !deck.scratchEnabled; - midi.sendShortMsg(deck.on, MaudioXponent.leds.scratch, deck.scratchEnabled); + midi.sendShortMsg(deck.on, MaudioXponent.buttons.scratch, deck.scratchEnabled); }; MaudioXponent.playlist = function(channel, control, value, status, group) { @@ -622,11 +622,11 @@ MaudioXponent.playlist = function(channel, control, value, status, group) { case 28: engine.setValue("[Playlist]", "SelectPrevTrack", 1); midi.sendShortMsg(deck.on, control, true); - break; + break; case 29: engine.setValue("[Playlist]", "SelectNextTrack", 1); midi.sendShortMsg(deck.on, control, true); - break; + break; case 30: var activenow = engine.getValue(deck.group, "play"); if (activenow == 1) { // If currently active @@ -635,15 +635,15 @@ MaudioXponent.playlist = function(channel, control, value, status, group) { engine.setValue(deck.group, "LoadSelectedTrack", 1); } midi.sendShortMsg(deck.on, control, true); - break; + break; case 31: engine.setValue("[Playlist]", "SelectPrevPlaylist", 1); midi.sendShortMsg(deck.on, control, true); - break; + break; case 32: engine.setValue("[Playlist]", "SelectNextPlaylist", 1); midi.sendShortMsg(deck.on, control, true); - break; + break; } }; @@ -655,7 +655,7 @@ MaudioXponent.playlistoff = function(channel, control, value, status, group) { MaudioXponent.keyLock = function(channel, control, value, status, group) { //script.midiDebug(channel, control, value, status); var deck = MaudioXponent.getDeck(group); - + if (!deck.shift) { // Unshifted = Keylock var currentValue = engine.getParameter(deck.group, "keylock"); @@ -664,7 +664,7 @@ MaudioXponent.keyLock = function(channel, control, value, status, group) { } else { engine.setValue(deck.group,"keylock", 0x00); } - }else{ + } else { // Shifted = Quantize var currentValue = engine.getParameter(deck.group, "quantize"); if (currentValue == 0){ @@ -672,12 +672,12 @@ MaudioXponent.keyLock = function(channel, control, value, status, group) { } else { engine.setValue(deck.group,"quantize", 0x00); } - } + } }; MaudioXponent.onkeyLock = function(value, group) { var deck = MaudioXponent.getDeck(group); - midi.sendShortMsg(deck.on, MaudioXponent.leds.key, value); + midi.sendShortMsg(deck.on, MaudioXponent.buttons.key, value); }; MaudioXponent.brake = function(channel, control, value, status, group) { @@ -692,9 +692,6 @@ MaudioXponent.cue = function(channel, control, value, status, group) { var deck = MaudioXponent.getDeck(group); var activate = (status == deck.on); engine.setValue(deck.group, "cue_default", activate); - - //TODO: Is this needed? - midi.sendShortMsg(deck.on, control, activate); }; MaudioXponent.play = function(channel, control, value, status, group) { @@ -709,7 +706,7 @@ MaudioXponent.play = function(channel, control, value, status, group) { MaudioXponent.onPlay = function(value, group, control) { var deck = MaudioXponent.getDeck(group); - midi.sendShortMsg(deck.on, MaudioXponent.leds[control], value); + midi.sendShortMsg(deck.on, MaudioXponent.buttons[control], value); }; MaudioXponent.beatgridAdjust = function(channel, control, value, status, group) { @@ -721,7 +718,7 @@ MaudioXponent.beatgridAdjust = function(channel, control, value, status, group) engine.setValue(deck.group, "beats_translate_curpos", 1); } else { // Unshifted = earlier / later - if (control == MaudioXponent.leds.leftkey){ + if (control == MaudioXponent.buttons.leftkey){ engine.setValue(deck.group, "beats_translate_earlier", 1); } else { engine.setValue(deck.group, "beats_translate_later", 1); @@ -757,12 +754,12 @@ MaudioXponent.nudge = function(channel, control, value, status, group) { //script.midiDebug(channel, control, value, status, group); var deck = MaudioXponent.getDeck(group); var activate = (status === deck.on); - engine.setValue(group, MaudioXponent.binleds[control], activate); + engine.setValue(group, MaudioXponent.buttons[control], activate); }; MaudioXponent.onNudge = function(value, group, control) { var deck = MaudioXponent.getDeck(group); - midi.sendShortMsg(deck.on, MaudioXponent.leds[control], value); + midi.sendShortMsg(deck.on, MaudioXponent.buttons[control], value); }; MaudioXponent.pfl = function(channel, control, value, status, group) { @@ -793,7 +790,7 @@ MaudioXponent.pfl = function(channel, control, value, status, group) { MaudioXponent.onPflChanged = function(value, group) { var deck = MaudioXponent.getDeck(group); - midi.sendShortMsg(deck.on, MaudioXponent.leds.pfl, value); + midi.sendShortMsg(deck.on, MaudioXponent.buttons.pfl, value); }; MaudioXponent.reverse = function(channel, control, value, status, group) { @@ -811,13 +808,13 @@ MaudioXponent.reverse = function(channel, control, value, status, group) { MaudioXponent.onReverse = function(value, group, control) { var deck = MaudioXponent.getDeck(group); - midi.sendShortMsg(deck.on, MaudioXponent.leds[control], value); + midi.sendShortMsg(deck.on, MaudioXponent.buttons[control], value); }; MaudioXponent.seek = function(channel, control, value, status, group) { var deck = MaudioXponent.getDeck(group); var activate = (status == deck.on); - engine.setValue(group, MaudioXponent.binleds[control], activate); + engine.setValue(group, MaudioXponent.buttons[control], activate); }; MaudioXponent.sampler = function(channel, control, value, status, group) { @@ -832,7 +829,7 @@ MaudioXponent.sampler = function(channel, control, value, status, group) { MaudioXponent.onSampler = function(value, group, control) { var samplerNumber = parseInt(group.substring(8)); - var led = MaudioXponent.leds.fx1 + samplerNumber - 1; + var led = MaudioXponent.buttons.fx1 + samplerNumber - 1; midi.sendShortMsg(MaudioXponent.on, led, value); midi.sendShortMsg(MaudioXponent.on + 5, led, value); }; From f5aa5f96c27f64f6dfb84ebba4b8fe67750f1367 Mon Sep 17 00:00:00 2001 From: Mel Grubb Date: Thu, 9 Mar 2017 22:37:09 -0500 Subject: [PATCH 07/20] Eliminated unused binLeds object --- .../M-Audio-Xponent-Advanced-scripts.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/res/controllers/M-Audio-Xponent-Advanced-scripts.js b/res/controllers/M-Audio-Xponent-Advanced-scripts.js index 035be79a22ec..2a27b218a69f 100644 --- a/res/controllers/M-Audio-Xponent-Advanced-scripts.js +++ b/res/controllers/M-Audio-Xponent-Advanced-scripts.js @@ -77,20 +77,6 @@ MaudioXponent.buttons = { "shift": 0x2C }; -MaudioXponent.binleds = { - 8: "button_parameter1", - 9: "button_parameter2", - 10: "button_parameter3", - 16: (MaudioXponent.config.nudgeButtonMode ? "rate_temp_up" : "rate_temp_down"), - 17: (MaudioXponent.config.nudgeButtonMode ? "rate_temp_down" : "rate_temp_up"), - 18: "keylock", - 19: "reverse", - 20: "pfl", - 33: "back", - 34: "fwd", - 36: "play" -}; - // ---------- Functions ---------- MaudioXponent.logParams = function(functionName, a, b, c, d, e, f) { print("***"); From b2e2b2bfb259391018e65e870e99edca3f7adbeb Mon Sep 17 00:00:00 2001 From: Mel Grubb Date: Mon, 13 Mar 2017 22:41:09 -0400 Subject: [PATCH 08/20] Updated shift-sync behavior to toggle master-sync --- res/controllers/M-Audio-Xponent-Advanced-scripts.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/res/controllers/M-Audio-Xponent-Advanced-scripts.js b/res/controllers/M-Audio-Xponent-Advanced-scripts.js index 2a27b218a69f..d09350d65c71 100644 --- a/res/controllers/M-Audio-Xponent-Advanced-scripts.js +++ b/res/controllers/M-Audio-Xponent-Advanced-scripts.js @@ -323,23 +323,24 @@ MaudioXponent.bankSwitch = function(channel, control, value, status, group) { }; MaudioXponent.beatsync = function(channel, control, value, status, group) { - //script.midiDebug(channel, control, value, status, group); + // script.midiDebug(channel, control, value, status, group); var deck = MaudioXponent.getDeck(group); var activate = (status == deck.on); if (activate) { if (MaudioXponent.leftDeck.shift && MaudioXponent.rightDeck.shift) { - // Double-shift = cycle modes + // Double-shift = cycle flash modes var mode = MaudioXponent.config.syncFlashMode + 1; - if(mode===3){ + if (mode === 3) { mode = 0; } MaudioXponent.config.syncFlashMode = mode; } else { - if (!deck.shift) { - engine.setValue(deck.group, "beatsync", 0x04); + if (deck.shift) { + var currentValue = engine.getValue(deck.group, "sync_enabled"); + engine.setValue(deck.group, "sync_enabled", !currentValue); } else { - engine.setValue(deck.group, "bpm_tap", 0x01); + engine.setValue(deck.group, "beatsync", activate); } } } From 38d300874f8c5056d21cfbd077282879b73260c1 Mon Sep 17 00:00:00 2001 From: Mel Grubb Date: Tue, 14 Mar 2017 19:28:08 -0400 Subject: [PATCH 09/20] Added library load from wheel or shift-cue --- .../M-Audio-Xponent-Advanced-scripts.js | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/res/controllers/M-Audio-Xponent-Advanced-scripts.js b/res/controllers/M-Audio-Xponent-Advanced-scripts.js index d09350d65c71..d0858593badd 100644 --- a/res/controllers/M-Audio-Xponent-Advanced-scripts.js +++ b/res/controllers/M-Audio-Xponent-Advanced-scripts.js @@ -489,10 +489,19 @@ MaudioXponent.wheelTouch = function(channel, control, value, status, group) { if (deck.scratchEnabled) { engine.scratchEnable(deck.id, 3 * 128, 33 + 1/3, 1.0/8, (1.0/8)/32); deck.scratching = true; + } else { + deck.lastTouch = new Date(); } } else { - engine.scratchDisable (deck.id); - deck.scratching = false; + if (deck.scratchEnabled) { + engine.scratchDisable (deck.id); + deck.scratching = false; + } else { + if (deck.lastTouch && (new Date() - deck.lastTouch < 1000)) + { + engine.setValue(deck.group, "LoadSelectedTrack", 1); + } + } } }; @@ -678,7 +687,14 @@ MaudioXponent.cue = function(channel, control, value, status, group) { //script.midiDebug(channel, control, value, status); var deck = MaudioXponent.getDeck(group); var activate = (status == deck.on); - engine.setValue(deck.group, "cue_default", activate); + + if (deck.shift) { + if (activate) { + engine.setValue(deck.group, "LoadSelectedTrack", 1); + } + } else { + engine.setValue(deck.group, "cue_default", activate); + } }; MaudioXponent.play = function(channel, control, value, status, group) { From d2729be77d54a470096d26aa1a68e81762a83340 Mon Sep 17 00:00:00 2001 From: Mel Grubb Date: Tue, 14 Mar 2017 19:41:14 -0400 Subject: [PATCH 10/20] Configurable tap duration, repaired seek --- .../M-Audio-Xponent-Advanced-scripts.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/res/controllers/M-Audio-Xponent-Advanced-scripts.js b/res/controllers/M-Audio-Xponent-Advanced-scripts.js index d0858593badd..9717c458e930 100644 --- a/res/controllers/M-Audio-Xponent-Advanced-scripts.js +++ b/res/controllers/M-Audio-Xponent-Advanced-scripts.js @@ -18,6 +18,7 @@ MaudioXponent.config = { pflMode : 0, // 0 = Independent, 1 = Toggle syncFlashMode : 0, // 0 = Off, 1 = Pulse, 2 = Toggle vuMeterMode : 1, // 0 = Master, 1 = Channel + tapDuration : 250, // Maximum touch duration for wheel tap (in milliseconds) } MaudioXponent.decks = @@ -77,6 +78,11 @@ MaudioXponent.buttons = { "shift": 0x2C }; +MaudioXponent.controls = { + 33 : "back", + 34 : "fwd", +}; + // ---------- Functions ---------- MaudioXponent.logParams = function(functionName, a, b, c, d, e, f) { print("***"); @@ -489,18 +495,15 @@ MaudioXponent.wheelTouch = function(channel, control, value, status, group) { if (deck.scratchEnabled) { engine.scratchEnable(deck.id, 3 * 128, 33 + 1/3, 1.0/8, (1.0/8)/32); deck.scratching = true; - } else { + } else if (deck.shift) { deck.lastTouch = new Date(); } } else { if (deck.scratchEnabled) { engine.scratchDisable (deck.id); deck.scratching = false; - } else { - if (deck.lastTouch && (new Date() - deck.lastTouch < 1000)) - { - engine.setValue(deck.group, "LoadSelectedTrack", 1); - } + } else if (deck.shift && deck.lastTouch && (new Date() - deck.lastTouch < MaudioXponent.config.tapDuration)) { + engine.setValue(deck.group, "LoadSelectedTrack", 1); } } }; @@ -815,9 +818,10 @@ MaudioXponent.onReverse = function(value, group, control) { }; MaudioXponent.seek = function(channel, control, value, status, group) { + script.midiDebug(channel, control, value, status, group); var deck = MaudioXponent.getDeck(group); var activate = (status == deck.on); - engine.setValue(group, MaudioXponent.buttons[control], activate); + engine.setValue(group, MaudioXponent.controls[control], activate); }; MaudioXponent.sampler = function(channel, control, value, status, group) { From 5bb231752b35459190dc1596f479413d6b5097ce Mon Sep 17 00:00:00 2001 From: Mel Grubb Date: Tue, 14 Mar 2017 19:48:39 -0400 Subject: [PATCH 11/20] Shift-BigX mapped to spinback --- res/controllers/M-Audio-Xponent-Advanced-scripts.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/res/controllers/M-Audio-Xponent-Advanced-scripts.js b/res/controllers/M-Audio-Xponent-Advanced-scripts.js index 9717c458e930..af5c62b3b27c 100644 --- a/res/controllers/M-Audio-Xponent-Advanced-scripts.js +++ b/res/controllers/M-Audio-Xponent-Advanced-scripts.js @@ -683,7 +683,12 @@ MaudioXponent.brake = function(channel, control, value, status, group) { //script.midiDebug(channel, control, value, status, group); var deck = MaudioXponent.getDeck(group); var activate = (status == deck.on); - engine.brake(deck.id, activate); + + if (deck.shift) { + engine.spinback(deck.id, activate); + } else { + engine.brake(deck.id, activate); + } }; MaudioXponent.cue = function(channel, control, value, status, group) { @@ -818,7 +823,7 @@ MaudioXponent.onReverse = function(value, group, control) { }; MaudioXponent.seek = function(channel, control, value, status, group) { - script.midiDebug(channel, control, value, status, group); + // script.midiDebug(channel, control, value, status, group); var deck = MaudioXponent.getDeck(group); var activate = (status == deck.on); engine.setValue(group, MaudioXponent.controls[control], activate); From 10effd93b4f7f5493d3726ecf7bb9998399ea128 Mon Sep 17 00:00:00 2001 From: Mel Grubb Date: Tue, 14 Mar 2017 20:01:46 -0400 Subject: [PATCH 12/20] Restored binLeds as controls array --- .../M-Audio-Xponent-Advanced-scripts.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/res/controllers/M-Audio-Xponent-Advanced-scripts.js b/res/controllers/M-Audio-Xponent-Advanced-scripts.js index af5c62b3b27c..c39877371b90 100644 --- a/res/controllers/M-Audio-Xponent-Advanced-scripts.js +++ b/res/controllers/M-Audio-Xponent-Advanced-scripts.js @@ -79,8 +79,17 @@ MaudioXponent.buttons = { }; MaudioXponent.controls = { - 33 : "back", - 34 : "fwd", + 8: "button_parameter1", + 9: "button_parameter2", + 10: "button_parameter3", + 16: (MaudioXponent.config.nudgeButtonMode ? "rate_temp_up" : "rate_temp_down"), + 17: (MaudioXponent.config.nudgeButtonMode ? "rate_temp_down" : "rate_temp_up"), + 18: "keylock", + 19: "reverse", + 20: "pfl", + 33: "back", + 34: "fwd", + 36: "play", }; // ---------- Functions ---------- @@ -401,7 +410,7 @@ MaudioXponent.filterKill = function(channel, control, value, status, group) { } else { // Low/Mid/High Buttons, momentary kill var group = "[EqualizerRack1_" + deck.group + "_Effect1]"; - engine.setValue(group, MaudioXponent.buttons[control], activate); + engine.setValue(group, MaudioXponent.controls[control], activate); } }; @@ -765,7 +774,7 @@ MaudioXponent.nudge = function(channel, control, value, status, group) { //script.midiDebug(channel, control, value, status, group); var deck = MaudioXponent.getDeck(group); var activate = (status === deck.on); - engine.setValue(group, MaudioXponent.buttons[control], activate); + engine.setValue(group, MaudioXponent.controls[control], activate); }; MaudioXponent.onNudge = function(value, group, control) { From 4f8760460d7dd54ae29232aae9e1793cbff491b6 Mon Sep 17 00:00:00 2001 From: Mel Grubb Date: Thu, 16 Mar 2017 20:17:12 -0400 Subject: [PATCH 13/20] Shut off sync lights when track stops. Extracted isPlaying. Eliminated more dead code. --- .../M-Audio-Xponent-Advanced-scripts.js | 106 ++++++------------ 1 file changed, 34 insertions(+), 72 deletions(-) diff --git a/res/controllers/M-Audio-Xponent-Advanced-scripts.js b/res/controllers/M-Audio-Xponent-Advanced-scripts.js index c39877371b90..1618d5167785 100644 --- a/res/controllers/M-Audio-Xponent-Advanced-scripts.js +++ b/res/controllers/M-Audio-Xponent-Advanced-scripts.js @@ -104,7 +104,7 @@ MaudioXponent.init = function (id) { MaudioXponent.initLights(); MaudioXponent.syncLights(); - //MaudioXponent.probeLights(); + // MaudioXponent.probeLights(); }; MaudioXponent.initDecks = function() { @@ -134,6 +134,9 @@ MaudioXponent.initDecks = function() { deck.filterMid = 1; deck.filterHigh = 1; deck.pregain = 1; + deck.isPlaying = function() { + return engine.getValue(this.group, "play"); + } engine.connectControl(group, "play_indicator", "MaudioXponent.onPlay"); engine.connectControl(group, "playposition", "MaudioXponent.onPlayPositionChange"); @@ -187,11 +190,12 @@ MaudioXponent.initDecks = function() { engine.softTakeover("[EffectRack1_EffectUnit" + i + "]", "mix", true); } - // TODO: It would be nice to discover some way to force the Xponent to dump its current status. + // It would be nice to discover some way to force the Xponent to dump its current status. // Until then, I just have to assume that you start on Bank A - MaudioXponent.bankSwitch(0, 0, 0, MaudioXponent.bankA, 0); + MaudioXponent.bankSwitch(0, 0, 0, MaudioXponent.bankA, 0); }; +// Debug/Test-only function MaudioXponent.probeLights = function() { var status = 0xB4; // for(status = 0xB0; status < 0xC0; status++) { @@ -323,7 +327,7 @@ MaudioXponent.vuMeter = function(mode, bank, side, value) { } MaudioXponent.bankSwitch = function(channel, control, value, status, group) { - //script.midiDebug(channel, control, value, status, group); + // script.midiDebug(channel, control, value, status, group); MaudioXponent.state.bank = status; if (status === MaudioXponent.bankA) { @@ -364,7 +368,7 @@ MaudioXponent.beatsync = function(channel, control, value, status, group) { }; MaudioXponent.punchIn = function(channel, control, value, status, group) { - //script.midiDebug(channel, control, value, status, group) + // script.midiDebug(channel, control, value, status, group) var deck = MaudioXponent.getDeck(group); var activate = (status == deck.on); @@ -389,7 +393,7 @@ MaudioXponent.filterKill = function(channel, control, value, status, group) { if (control === MaudioXponent.buttons.gain) { // Gain Buttons if (activate && (MaudioXponent.leftDeck.shift && MaudioXponent.rightDeck.shift)) { - //Double-shift = cycle modes + // Double-shift = cycle modes var mode = MaudioXponent.config.vuMeterMode + 1; if (mode === 2) { mode = 0; @@ -420,7 +424,7 @@ MaudioXponent.onFilterKill = function(value, group, control) { }; MaudioXponent.effectButton = function(channel, control, value, status, group) { - //script.midiDebug(channel, control, value, status, group); + // script.midiDebug(channel, control, value, status, group); var deck = MaudioXponent.getDeck(group); var currentControl = control - 0x0B; var group = "[EffectRack1_EffectUnit" + currentControl + "]"; @@ -496,7 +500,7 @@ MaudioXponent.wheel = function (channel, control, value, status, group) { }; MaudioXponent.wheelTouch = function(channel, control, value, status, group) { - //script.midiDebug(channel, control, value, status, group) + // script.midiDebug(channel, control, value, status, group) var deck = MaudioXponent.getDeck(group); var activate = (status == deck.on); @@ -540,7 +544,7 @@ MaudioXponent.onBeatLoop = function(value, group, control) { }; MaudioXponent.onBpmChanged = function(value, group) { - //print ("BPM Change, " + group + ", value=" + value); + // print ("BPM Change, " + group + ", value=" + value); }; MaudioXponent.onPlayPositionChange = function(value, group) { @@ -550,7 +554,7 @@ MaudioXponent.onPlayPositionChange = function(value, group) { value = engine.getValue(group, "playposition"); deck.playPosition = value; - if ((value < deck.warnAt) || (!engine.getValue(group, "play")) || (value >= deck.warnAt && deck.beatState)) { + if ((value < deck.warnAt) || (!deck.isPlaying()) || (value >= deck.warnAt && deck.beatState)) { midi.sendShortMsg(deck.progressMeterStatusByte, deck.progressMeterSecondByte, MaudioXponent.convert(value)); } else { midi.sendShortMsg(deck.progressMeterStatusByte, deck.progressMeterSecondByte, 0x00); @@ -558,7 +562,7 @@ MaudioXponent.onPlayPositionChange = function(value, group) { }; MaudioXponent.hotcue = function(channel, control, value, status, group) { - //script.midiDebug(channel, control, value, status, group) + // script.midiDebug(channel, control, value, status, group) var deck = MaudioXponent.getDeck(group); var cueNumber = control - 0x16; @@ -618,68 +622,22 @@ MaudioXponent.shift = function(channel, control, value, status, group) { }; MaudioXponent.toggleScratchMode = function(channel, control, value, status, group) { - //script.midiDebug(channel, control, value, status, group); + // script.midiDebug(channel, control, value, status, group); var deck = MaudioXponent.getDeck(group); deck.scratchEnabled = !deck.scratchEnabled; midi.sendShortMsg(deck.on, MaudioXponent.buttons.scratch, deck.scratchEnabled); }; -MaudioXponent.playlist = function(channel, control, value, status, group) { - var deck = MaudioXponent.getDeck(group); - switch (control) { - case 28: - engine.setValue("[Playlist]", "SelectPrevTrack", 1); - midi.sendShortMsg(deck.on, control, true); - break; - case 29: - engine.setValue("[Playlist]", "SelectNextTrack", 1); - midi.sendShortMsg(deck.on, control, true); - break; - case 30: - var activenow = engine.getValue(deck.group, "play"); - if (activenow == 1) { // If currently active - engine.setValue("[Playlist]", "LoadSelectedIntoFirstStopped", 1); - } else { - engine.setValue(deck.group, "LoadSelectedTrack", 1); - } - midi.sendShortMsg(deck.on, control, true); - break; - case 31: - engine.setValue("[Playlist]", "SelectPrevPlaylist", 1); - midi.sendShortMsg(deck.on, control, true); - break; - case 32: - engine.setValue("[Playlist]", "SelectNextPlaylist", 1); - midi.sendShortMsg(deck.on, control, true); - break; - } -}; - -MaudioXponent.playlistoff = function(channel, control, value, status, group) { - var deck = MaudioXponent.getDeck(group); - midi.sendShortMsg(deck.on, control, false); -}; - MaudioXponent.keyLock = function(channel, control, value, status, group) { - //script.midiDebug(channel, control, value, status); + // script.midiDebug(channel, control, value, status); var deck = MaudioXponent.getDeck(group); if (!deck.shift) { // Unshifted = Keylock - var currentValue = engine.getParameter(deck.group, "keylock"); - if (currentValue == 0){ - engine.setValue(deck.group,"keylock",0x01); - } else { - engine.setValue(deck.group,"keylock", 0x00); - } + engine.setValue(deck.group, "keylock", !engine.getParameter(deck.group, "keylock")); } else { // Shifted = Quantize - var currentValue = engine.getParameter(deck.group, "quantize"); - if (currentValue == 0){ - engine.setValue(deck.group,"quantize",0x01); - } else { - engine.setValue(deck.group,"quantize", 0x00); - } + engine.setValue(deck.group, "quantize", !engine.getParameter(deck.group, "quantize")); } }; @@ -689,19 +647,21 @@ MaudioXponent.onkeyLock = function(value, group) { }; MaudioXponent.brake = function(channel, control, value, status, group) { - //script.midiDebug(channel, control, value, status, group); + // script.midiDebug(channel, control, value, status, group); var deck = MaudioXponent.getDeck(group); var activate = (status == deck.on); if (deck.shift) { engine.spinback(deck.id, activate); } else { - engine.brake(deck.id, activate); + if (deck.isPlaying()) { + engine.brake(deck.id, activate); + } } }; MaudioXponent.cue = function(channel, control, value, status, group) { - //script.midiDebug(channel, control, value, status); + // script.midiDebug(channel, control, value, status); var deck = MaudioXponent.getDeck(group); var activate = (status == deck.on); @@ -715,22 +675,25 @@ MaudioXponent.cue = function(channel, control, value, status, group) { }; MaudioXponent.play = function(channel, control, value, status, group) { - //script.midiDebug(channel, control, value, status); + // script.midiDebug(channel, control, value, status); var deck = MaudioXponent.getDeck(group); var activate = (status == deck.on); if (activate) { - var playing = engine.getValue(group, "play"); - engine.setValue(deck.group, "play", !playing); + engine.setValue(deck.group, "play", !deck.isPlaying()); } }; MaudioXponent.onPlay = function(value, group, control) { var deck = MaudioXponent.getDeck(group); midi.sendShortMsg(deck.on, MaudioXponent.buttons[control], value); + + if (!value) { + midi.sendShortMsg(deck.on, MaudioXponent.buttons.sync, 0x00); + } }; MaudioXponent.beatgridAdjust = function(channel, control, value, status, group) { - //script.midiDebug(channel, control, value, status, group); + // script.midiDebug(channel, control, value, status, group); var deck = MaudioXponent.getDeck(group); if (deck.shift) { @@ -771,7 +734,7 @@ MaudioXponent.onTrackLoaded = function(duration, group) { }; MaudioXponent.nudge = function(channel, control, value, status, group) { - //script.midiDebug(channel, control, value, status, group); + // script.midiDebug(channel, control, value, status, group); var deck = MaudioXponent.getDeck(group); var activate = (status === deck.on); engine.setValue(group, MaudioXponent.controls[control], activate); @@ -783,7 +746,7 @@ MaudioXponent.onNudge = function(value, group, control) { }; MaudioXponent.pfl = function(channel, control, value, status, group) { - //script.midiDebug(channel, control, value, status, group); + // script.midiDebug(channel, control, value, status, group); var deck = MaudioXponent.getDeck(group); var activate = (status == deck.on); @@ -840,8 +803,7 @@ MaudioXponent.seek = function(channel, control, value, status, group) { MaudioXponent.sampler = function(channel, control, value, status, group) { // script.midiDebug(channel, control, value, status, group); - var shifted = MaudioXponent.decks[0].shift || MaudioXponent.decks[2].shift; - if (shifted) { + if (MaudioXponent.leftDeck.shift) { engine.setValue(group, "cue_gotoandstop", 1); } else { engine.setValue(group, "cue_gotoandplay", 1); From 5c19b1fa306c83b4904571dd343dd6e3100e590b Mon Sep 17 00:00:00 2001 From: Mel Grubb Date: Thu, 16 Mar 2017 20:43:33 -0400 Subject: [PATCH 14/20] Fixed rolling loop lights --- .../M-Audio-Xponent-Advanced-scripts.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/res/controllers/M-Audio-Xponent-Advanced-scripts.js b/res/controllers/M-Audio-Xponent-Advanced-scripts.js index 1618d5167785..cb320c10d903 100644 --- a/res/controllers/M-Audio-Xponent-Advanced-scripts.js +++ b/res/controllers/M-Audio-Xponent-Advanced-scripts.js @@ -18,15 +18,15 @@ MaudioXponent.config = { pflMode : 0, // 0 = Independent, 1 = Toggle syncFlashMode : 0, // 0 = Off, 1 = Pulse, 2 = Toggle vuMeterMode : 1, // 0 = Master, 1 = Channel - tapDuration : 250, // Maximum touch duration for wheel tap (in milliseconds) -} + tapDuration : 250 // Maximum touch duration for wheel tap (in milliseconds) +}; MaudioXponent.decks = [ { noteOffset : 0, on : 0x90, off : 0x80, isLeft : true, isRight : false, isBankA : true, isBankB : false }, { noteOffset : 1, on : 0x91, off : 0x81, isLeft : false, isRight : true, isBankA : true, isBankB : false }, { noteOffset : 5, on : 0x95, off : 0x85, isLeft : true, isRight : false, isBankA : false, isBankB : true }, - { noteOffset : 6, on : 0x96, off : 0x86, isLeft : false, isRight : true, isBankA : false, isBankB : true }, + { noteOffset : 6, on : 0x96, off : 0x86, isLeft : false, isRight : true, isBankA : false, isBankB : true } ]; MaudioXponent.state = { @@ -34,7 +34,7 @@ MaudioXponent.state = { faderPosition : 0, // Temporary storage for cross-fader position during punch-ins. focusedEffect : 0, plnumberpos : 0, - plnumberneg : 0, + plnumberneg : 0 }; MaudioXponent.buttons = { @@ -182,7 +182,7 @@ MaudioXponent.initDecks = function() { engine.connectControl(group, "play_indicator", "MaudioXponent.onSampler"); } - // Effects parameters... not working in Mixxx 2.0, should work in 2.1 + // Effects parameters... soft-takeove not working in Mixxx 2.0, should work in 2.1 for(i = 1; i <= 4; i++) { engine.softTakeover("[EffectRack1_EffectUnit" + i + "_Effect1]", "parameter1", true); engine.softTakeover("[EffectRack1_EffectUnit" + i + "_Effect1]", "parameter2", true); @@ -539,8 +539,10 @@ MaudioXponent.onBeatActive = function(value, group) { MaudioXponent.onBeatLoop = function(value, group, control) { var deck = MaudioXponent.getDeck(group); - var offset = Math.log(parseInt(control.substring(9))) / Math.log(2) - midi.sendShortMsg(deck.on, MaudioXponent.buttons.loop1, value); + var offset = deck.shift + ? Math.log(1 / parseFloat(control.substring(9))) / Math.log(2) + : Math.log(parseFloat(control.substring(9))) / Math.log(2); + midi.sendShortMsg(deck.on, MaudioXponent.buttons.loop1 + offset, value); }; MaudioXponent.onBpmChanged = function(value, group) { From 6138cd12499e8d06e46e90a39325c659075be61f Mon Sep 17 00:00:00 2001 From: Mel Grubb Date: Sat, 18 Mar 2017 11:04:46 -0400 Subject: [PATCH 15/20] Changed linters and fixed up code Moving crossfader exits punch-in. Soft-takeover doesn't obey, though. --- .../M-Audio Xponent (Advanced).midi.xml | 6 +- .../M-Audio-Xponent-Advanced-scripts.js | 86 ++++++++++--------- 2 files changed, 50 insertions(+), 42 deletions(-) diff --git a/res/controllers/M-Audio Xponent (Advanced).midi.xml b/res/controllers/M-Audio Xponent (Advanced).midi.xml index 9ecd4ca002ae..9f7333f2c5e4 100644 --- a/res/controllers/M-Audio Xponent (Advanced).midi.xml +++ b/res/controllers/M-Audio Xponent (Advanced).midi.xml @@ -3170,12 +3170,12 @@ [Master] - crossfader + MaudioXponent.crossfader Crossfader 0xB2 0x07 - + @@ -3185,7 +3185,7 @@ 0xB7 0x07 - + diff --git a/res/controllers/M-Audio-Xponent-Advanced-scripts.js b/res/controllers/M-Audio-Xponent-Advanced-scripts.js index cb320c10d903..0b44506f4b3d 100644 --- a/res/controllers/M-Audio-Xponent-Advanced-scripts.js +++ b/res/controllers/M-Audio-Xponent-Advanced-scripts.js @@ -1,3 +1,5 @@ +/* global engine script midi */ + function MaudioXponent () {} // ---------- Global variables ---------- @@ -18,7 +20,7 @@ MaudioXponent.config = { pflMode : 0, // 0 = Independent, 1 = Toggle syncFlashMode : 0, // 0 = Off, 1 = Pulse, 2 = Toggle vuMeterMode : 1, // 0 = Master, 1 = Channel - tapDuration : 250 // Maximum touch duration for wheel tap (in milliseconds) + tapDuration : 250, // Maximum touch duration for wheel tap (in milliseconds) }; MaudioXponent.decks = @@ -26,7 +28,7 @@ MaudioXponent.decks = { noteOffset : 0, on : 0x90, off : 0x80, isLeft : true, isRight : false, isBankA : true, isBankB : false }, { noteOffset : 1, on : 0x91, off : 0x81, isLeft : false, isRight : true, isBankA : true, isBankB : false }, { noteOffset : 5, on : 0x95, off : 0x85, isLeft : true, isRight : false, isBankA : false, isBankB : true }, - { noteOffset : 6, on : 0x96, off : 0x86, isLeft : false, isRight : true, isBankA : false, isBankB : true } + { noteOffset : 6, on : 0x96, off : 0x86, isLeft : false, isRight : true, isBankA : false, isBankB : true }, ]; MaudioXponent.state = { @@ -34,7 +36,7 @@ MaudioXponent.state = { faderPosition : 0, // Temporary storage for cross-fader position during punch-ins. focusedEffect : 0, plnumberpos : 0, - plnumberneg : 0 + plnumberneg : 0, }; MaudioXponent.buttons = { @@ -75,7 +77,7 @@ MaudioXponent.buttons = { "button_parameter2": 0x09, "button_parameter3": 0x0A, "gain": 0x0B, - "shift": 0x2C + "shift": 0x2C, }; MaudioXponent.controls = { @@ -99,7 +101,7 @@ MaudioXponent.logParams = function(functionName, a, b, c, d, e, f) { print("***"); }; -MaudioXponent.init = function (id) { +MaudioXponent.init = function () { MaudioXponent.initDecks(); MaudioXponent.initLights(); MaudioXponent.syncLights(); @@ -116,7 +118,7 @@ MaudioXponent.initDecks = function() { engine.connectControl("[Channel3]", "VuMeterL", function(value) { MaudioXponent.vuMeter(1, MaudioXponent.bankB, 0, value); }); engine.connectControl("[Channel4]", "VuMeterR", function(value) { MaudioXponent.vuMeter(1, MaudioXponent.bankB, 1, value); }); - for (channel = 1; channel <= MaudioXponent.maxDecks; channel++) { + for (var channel = 1; channel <= MaudioXponent.maxDecks; channel++) { var group = "[Channel" + (channel) + "]"; var deck = MaudioXponent.decks[channel - 1]; deck.id = channel; @@ -136,7 +138,7 @@ MaudioXponent.initDecks = function() { deck.pregain = 1; deck.isPlaying = function() { return engine.getValue(this.group, "play"); - } + }; engine.connectControl(group, "play_indicator", "MaudioXponent.onPlay"); engine.connectControl(group, "playposition", "MaudioXponent.onPlayPositionChange"); @@ -144,7 +146,7 @@ MaudioXponent.initDecks = function() { engine.connectControl(group, "beat_active", "MaudioXponent.onBeatActive"); engine.connectControl(group, "eject", "MaudioXponent.onEject"); - for (i = 1; i <= 5; i++) { + for (var i = 1; i <= 5; i++) { engine.connectControl(group, "hotcue_" + i + "_enabled", "MaudioXponent.onHotCue"); } @@ -168,6 +170,7 @@ MaudioXponent.initDecks = function() { engine.connectControl("[EqualizerRack1_" + group + "_Effect1]", "button_parameter2", "MaudioXponent.onFilterKill"); engine.connectControl("[EqualizerRack1_" + group + "_Effect1]", "button_parameter3", "MaudioXponent.onFilterKill"); + engine.softTakeover("[Master]", "crossfader", true); engine.softTakeover(group, "rate", true); engine.softTakeover(group, "volume", true); @@ -178,7 +181,7 @@ MaudioXponent.initDecks = function() { } for (i = 1; i <=4; i++) { - var group = "[Sampler" + i + "]"; + group = "[Sampler" + i + "]"; engine.connectControl(group, "play_indicator", "MaudioXponent.onSampler"); } @@ -199,14 +202,14 @@ MaudioXponent.initDecks = function() { MaudioXponent.probeLights = function() { var status = 0xB4; // for(status = 0xB0; status < 0xC0; status++) { - for (var led in MaudioXponent.buttons) { - var byte2 = MaudioXponent.buttons[led]; - // for(byte2 = 0; byte2 < 128; byte2++) { - for(byte3 = 0; byte3 < 128; byte3++) { - midi.sendShortMsg(status, byte2, byte3); - MaudioXponent.pauseScript(5); - } + for (var led in MaudioXponent.buttons) { + var byte2 = MaudioXponent.buttons[led]; + // for(byte2 = 0; byte2 < 128; byte2++) { + for(var byte3 = 0; byte3 < 128; byte3++) { + midi.sendShortMsg(status, byte2, byte3); + MaudioXponent.pauseScript(5); } + } // } }; @@ -221,7 +224,7 @@ MaudioXponent.initLights = function () { MaudioXponent.pauseScript(15); } - for(i = 0; i <= 10; i += 1) { + for(var i = 0; i <= 10; i += 1) { var value = MaudioXponent.convert(i * 0.1); // VU meters midi.sendShortMsg(MaudioXponent.leftDeck.vuMeterStatusByte, MaudioXponent.leftDeck.vuMeterSecondByte, value); @@ -236,7 +239,7 @@ MaudioXponent.initLights = function () { MaudioXponent.pauseScript(500); - for (var led in MaudioXponent.buttons) { + for (led in MaudioXponent.buttons) { midi.sendShortMsg(MaudioXponent.on, MaudioXponent.buttons[led], 0x00); midi.sendShortMsg(MaudioXponent.on + 1, MaudioXponent.buttons[led], 0x00); MaudioXponent.pauseScript(15); @@ -251,7 +254,7 @@ MaudioXponent.initLights = function () { midi.sendShortMsg(MaudioXponent.rightDeck.progressMeterStatusByte, MaudioXponent.rightDeck.progressMeterSecondByte, 0); }; -MaudioXponent.shutdown = function (id) { +MaudioXponent.shutdown = function () { for (var led in MaudioXponent.buttons) { midi.sendShortMsg(MaudioXponent.on, MaudioXponent.buttons[led], 0x00); midi.sendShortMsg(MaudioXponent.on + 1,MaudioXponent.buttons[led], 0x00); @@ -270,7 +273,7 @@ MaudioXponent.shutdown = function (id) { }; MaudioXponent.syncLights = function() { - for (i = 0; i < MaudioXponent.decks.length; i++) { + for (var i = 0; i < MaudioXponent.decks.length; i++) { var deck = MaudioXponent.decks[i]; engine.trigger(deck.group, "play_indicator"); @@ -307,8 +310,8 @@ MaudioXponent.getDeck = function(group) { }; MaudioXponent.pauseScript = function(ms) { - startDate = new Date(); - currentDate = null; + var startDate = new Date(); + var currentDate = null; while(currentDate-startDate < ms) currentDate = new Date(); }; @@ -324,10 +327,10 @@ MaudioXponent.vuMeter = function(mode, bank, side, value) { } } } -} +}; -MaudioXponent.bankSwitch = function(channel, control, value, status, group) { - // script.midiDebug(channel, control, value, status, group); +MaudioXponent.bankSwitch = function(channel, control, value, status) { + // script.midiDebug(channel, control, value, status); MaudioXponent.state.bank = status; if (status === MaudioXponent.bankA) { @@ -373,7 +376,8 @@ MaudioXponent.punchIn = function(channel, control, value, status, group) { var activate = (status == deck.on); if (activate) { - MaudioXponent.state.faderPosition = faderPosition = engine.getValue("[Master]", "crossfader"); + var faderPosition = engine.getValue("[Master]", "crossfader"); + MaudioXponent.state.faderPosition = faderPosition; if ((faderPosition >= 0.90 && deck.isLeft) || (faderPosition <= -0.90 && deck.isRight)) { engine.setValue("[Master]", "crossfader", 0); @@ -413,7 +417,7 @@ MaudioXponent.filterKill = function(channel, control, value, status, group) { } } else { // Low/Mid/High Buttons, momentary kill - var group = "[EqualizerRack1_" + deck.group + "_Effect1]"; + group = "[EqualizerRack1_" + deck.group + "_Effect1]"; engine.setValue(group, MaudioXponent.controls[control], activate); } }; @@ -427,7 +431,7 @@ MaudioXponent.effectButton = function(channel, control, value, status, group) { // script.midiDebug(channel, control, value, status, group); var deck = MaudioXponent.getDeck(group); var currentControl = control - 0x0B; - var group = "[EffectRack1_EffectUnit" + currentControl + "]"; + group = "[EffectRack1_EffectUnit" + currentControl + "]"; if (deck.shift) { // Cycle effects @@ -447,7 +451,7 @@ MaudioXponent.effectButton = function(channel, control, value, status, group) { } // Light the focused effect - for (i = 0; i < 4; i++) { + for (var i = 0; i < 4; i++) { var ctrl = MaudioXponent.buttons.fx1 + i; var fxNum = i + 1; var newValue = (fxNum == MaudioXponent.state.focusedEffect) ? 1 : 0; @@ -458,11 +462,10 @@ MaudioXponent.effectButton = function(channel, control, value, status, group) { MaudioXponent.effectParameter = function(channel, control, value, status, group) { // script.midiDebug(channel, control, value, status, group); - var deck = MaudioXponent.getDeck(group); var currentControl = control - 0x0B; if (MaudioXponent.state.focusedEffect != 0) { - var group = "[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffect + "_Effect1]"; + group = "[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffect + "_Effect1]"; var scaledValue = value / 0x7F; if (currentControl == 4) { @@ -545,13 +548,12 @@ MaudioXponent.onBeatLoop = function(value, group, control) { midi.sendShortMsg(deck.on, MaudioXponent.buttons.loop1 + offset, value); }; -MaudioXponent.onBpmChanged = function(value, group) { +MaudioXponent.onBpmChanged = function(/*value, group*/) { // print ("BPM Change, " + group + ", value=" + value); }; MaudioXponent.onPlayPositionChange = function(value, group) { var deck = MaudioXponent.getDeck(group); - var status = MaudioXponent.bank value = engine.getValue(group, "playposition"); deck.playPosition = value; @@ -587,7 +589,7 @@ MaudioXponent.loopin = function(channel, control, value, status, group) { engine.setValue(deck.group, "loop_in", !deck.shift); }; -MaudioXponent.onLoopIn = function(value, group, control) { +MaudioXponent.onLoopIn = function(value, group) { var deck = MaudioXponent.getDeck(group); midi.sendShortMsg(deck.on, MaudioXponent.buttons.loopIn, value); }; @@ -597,7 +599,7 @@ MaudioXponent.loopout = function(channel, control, value, status, group) { engine.setValue(deck.group, "loop_out", !deck.shift); }; -MaudioXponent.onLoopOut = function(value, group, control) { +MaudioXponent.onLoopOut = function(value, group) { var deck = MaudioXponent.getDeck(group); midi.sendShortMsg(deck.on, MaudioXponent.buttons.loopOut, value); }; @@ -610,7 +612,7 @@ MaudioXponent.loopexit = function(channel, control, value, status, group) { MaudioXponent.onLoopExit = function(value, group, control) { var deck = MaudioXponent.getDeck(group); midi.sendShortMsg(deck.on, MaudioXponent.buttons.loop, engine.getValue(group, control) == 1); -} +}; MaudioXponent.pitch = function(channel, control, value, status, group) { engine.setValue(group, "rate", script.midiPitch(control, value, status)); @@ -761,7 +763,7 @@ MaudioXponent.pfl = function(channel, control, value, status, group) { } MaudioXponent.config.pflMode = mode; } else { - for (i = 1; i <= MaudioXponent.decks.length; i++) { + for (var i = 1; i <= MaudioXponent.decks.length; i++) { var grp = "[Channel" + i + "]"; if (grp === group) { engine.setValue(grp, "pfl", !engine.getValue(grp, "pfl")); @@ -812,16 +814,22 @@ MaudioXponent.sampler = function(channel, control, value, status, group) { } }; -MaudioXponent.onSampler = function(value, group, control) { +MaudioXponent.onSampler = function(value, group) { var samplerNumber = parseInt(group.substring(8)); var led = MaudioXponent.buttons.fx1 + samplerNumber - 1; midi.sendShortMsg(MaudioXponent.on, led, value); midi.sendShortMsg(MaudioXponent.on + 5, led, value); }; -MaudioXponent.onEject = function(value, group, control) { +MaudioXponent.onEject = function(value, group) { if (value) { engine.setValue(group, "playposition", 0); MaudioXponent.onPlayPositionChange(null, group); } +}; + +MaudioXponent.crossfader = function(channel, control, value, status, group) { + //script.midiDebug(channel, control, value, status, group); + MaudioXponent.state.faderPosition = (value - 64) / 64; + engine.setValue(group, "crossfader", MaudioXponent.state.faderPosition); }; \ No newline at end of file From 53b11be875a9df21ad132d3be1db906a982ae041 Mon Sep 17 00:00:00 2001 From: Mel Grubb Date: Sat, 18 Mar 2017 13:30:30 -0400 Subject: [PATCH 16/20] Changed shift-cue to seek to track start. --- res/controllers/M-Audio-Xponent-Advanced-scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/controllers/M-Audio-Xponent-Advanced-scripts.js b/res/controllers/M-Audio-Xponent-Advanced-scripts.js index 0b44506f4b3d..969a2773e2a0 100644 --- a/res/controllers/M-Audio-Xponent-Advanced-scripts.js +++ b/res/controllers/M-Audio-Xponent-Advanced-scripts.js @@ -671,7 +671,7 @@ MaudioXponent.cue = function(channel, control, value, status, group) { if (deck.shift) { if (activate) { - engine.setValue(deck.group, "LoadSelectedTrack", 1); + engine.setValue(deck.group, "start_stop", 1); } } else { engine.setValue(deck.group, "cue_default", activate); From dbaf4122c7bd8333d9af0ef5f28035941891dc66 Mon Sep 17 00:00:00 2001 From: Mel Grubb Date: Mon, 20 Mar 2017 22:16:28 -0400 Subject: [PATCH 17/20] Finalizing effects controls. Fixed broken crossfader on bank b. --- .../M-Audio Xponent (Advanced).midi.xml | 4 +- .../M-Audio-Xponent-Advanced-scripts.js | 85 +++++++++++-------- 2 files changed, 51 insertions(+), 38 deletions(-) diff --git a/res/controllers/M-Audio Xponent (Advanced).midi.xml b/res/controllers/M-Audio Xponent (Advanced).midi.xml index 9f7333f2c5e4..82111a52ad9d 100644 --- a/res/controllers/M-Audio Xponent (Advanced).midi.xml +++ b/res/controllers/M-Audio Xponent (Advanced).midi.xml @@ -13,6 +13,8 @@ + + @@ -3180,7 +3182,7 @@ [Master] - crossfader + MaudioXponent.crossfader Crossfader 0xB7 0x07 diff --git a/res/controllers/M-Audio-Xponent-Advanced-scripts.js b/res/controllers/M-Audio-Xponent-Advanced-scripts.js index 969a2773e2a0..d54f8cfe5420 100644 --- a/res/controllers/M-Audio-Xponent-Advanced-scripts.js +++ b/res/controllers/M-Audio-Xponent-Advanced-scripts.js @@ -34,7 +34,7 @@ MaudioXponent.decks = MaudioXponent.state = { bank : 0, // Which position is the bank switch currently set to? faderPosition : 0, // Temporary storage for cross-fader position during punch-ins. - focusedEffect : 0, + focusedEffectUnit : 0, // Which overall effect chain has the focus plnumberpos : 0, plnumberneg : 0, }; @@ -174,10 +174,9 @@ MaudioXponent.initDecks = function() { engine.softTakeover(group, "rate", true); engine.softTakeover(group, "volume", true); - // Soft-takeovers that aren't yet working correctly (Might need to save/restore on bank change) - engine.softTakeover(group, "filterLow", true); - engine.softTakeover(group, "filterMid", true); - engine.softTakeover(group, "filterHigh", true); + engine.softTakeover("[EqualizerRack1_" + group + "_Effect1]", "parameter1", true); + engine.softTakeover("[EqualizerRack1_" + group + "_Effect1]", "parameter2", true); + engine.softTakeover("[EqualizerRack1_" + group + "_Effect1]", "parameter3", true); } for (i = 1; i <=4; i++) { @@ -185,7 +184,7 @@ MaudioXponent.initDecks = function() { engine.connectControl(group, "play_indicator", "MaudioXponent.onSampler"); } - // Effects parameters... soft-takeove not working in Mixxx 2.0, should work in 2.1 + // Effects parameters... soft-takeover not working in Mixxx 2.0, should work in 2.1 for(i = 1; i <= 4; i++) { engine.softTakeover("[EffectRack1_EffectUnit" + i + "_Effect1]", "parameter1", true); engine.softTakeover("[EffectRack1_EffectUnit" + i + "_Effect1]", "parameter2", true); @@ -340,7 +339,7 @@ MaudioXponent.bankSwitch = function(channel, control, value, status) { MaudioXponent.leftDeck = MaudioXponent.decks[2]; MaudioXponent.rightDeck = MaudioXponent.decks[3]; } - + MaudioXponent.syncLights(); }; @@ -430,50 +429,62 @@ MaudioXponent.onFilterKill = function(value, group, control) { MaudioXponent.effectButton = function(channel, control, value, status, group) { // script.midiDebug(channel, control, value, status, group); var deck = MaudioXponent.getDeck(group); - var currentControl = control - 0x0B; - group = "[EffectRack1_EffectUnit" + currentControl + "]"; + var button = control - 0x0B; if (deck.shift) { - // Cycle effects - engine.setValue(group, "next_chain", 1); - } else { - if (currentControl == MaudioXponent.state.focusedEffect) { - // Toggle enabled - var effectEnabled = engine.getValue(group, "enabled"); - if (effectEnabled) { - engine.setValue(group, "enabled", 0); - } else { - engine.setValue(group, "enabled", 1); - } - } else { - // Change focus - MaudioXponent.state.focusedEffect = currentControl; - } + // Focus/Unfocus EffectUnit + MaudioXponent.state.focusedEffectUnit = (button === MaudioXponent.state.focusedEffectUnit) ? 0 : button; // Light the focused effect for (var i = 0; i < 4; i++) { var ctrl = MaudioXponent.buttons.fx1 + i; - var fxNum = i + 1; - var newValue = (fxNum == MaudioXponent.state.focusedEffect) ? 1 : 0; + var newValue = (i + 1 === MaudioXponent.state.focusedEffectUnit) ? 1 : 0; midi.sendShortMsg(deck.on, ctrl, newValue); } + } else { + // Toggle EffectUnit + group = "[EffectRack1_EffectUnit" + button + "]"; + var effectEnabled = !engine.getValue(group, "enabled"); + engine.setValue(group, "enabled", effectEnabled); } }; MaudioXponent.effectParameter = function(channel, control, value, status, group) { // script.midiDebug(channel, control, value, status, group); - var currentControl = control - 0x0B; - - if (MaudioXponent.state.focusedEffect != 0) { - group = "[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffect + "_Effect1]"; - var scaledValue = value / 0x7F; - - if (currentControl == 4) { - // Wet / Dry - engine.setParameter("[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffect + "]", "mix", scaledValue); + var knob = control - 0x0B; + var scaledValue = value / 0x7F; + + if (MaudioXponent.state.focusedEffectUnit != 0) { + if (MaudioXponent.rightDeck.shift) { + // Manipulate focused EffectUnit parameters + if (knob == 4) { + // Wet / Dry + engine.setParameter("[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffectUnit + "]", "mix", scaledValue); + } else { + // Other parameter + engine.setParameter("[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffectUnit + "_Effect1]", "parameter" + knob, scaledValue); + } + } else { + // Manipulate focused EffectUnit meta/super knobs + if (knob == 4) { + // Super-knob + group = "[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffectUnit + "]"; + engine.setParameter(group, "super1", scaledValue); + } else { + // Meta-knob + group = "[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffectUnit + "_Effect" + knob + "]"; + engine.setParameter(group, "meta", scaledValue); + } + } + } else { + if (MaudioXponent.rightDeck.shift) { + // Manipulate Wet/Dry mix + group = "[EffectRack1_EffectUnit" + knob + "]"; + engine.setParameter(group, "mix", scaledValue); } else { - // Other parameter - engine.setParameter(group, "parameter" + currentControl, scaledValue); + // Manipulate Super-knobs + group = "[EffectRack1_EffectUnit" + knob + "]"; + engine.setParameter(group, "super1", scaledValue); } } }; From 8a01ffb94ac26fc1b97e8ebfba4c4494a02564bc Mon Sep 17 00:00:00 2001 From: Mel Grubb Date: Mon, 20 Mar 2017 22:33:34 -0400 Subject: [PATCH 18/20] Hotcues only on activate --- res/controllers/M-Audio-Xponent-Advanced-scripts.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/res/controllers/M-Audio-Xponent-Advanced-scripts.js b/res/controllers/M-Audio-Xponent-Advanced-scripts.js index d54f8cfe5420..4f20e70ab709 100644 --- a/res/controllers/M-Audio-Xponent-Advanced-scripts.js +++ b/res/controllers/M-Audio-Xponent-Advanced-scripts.js @@ -580,12 +580,14 @@ MaudioXponent.hotcue = function(channel, control, value, status, group) { // script.midiDebug(channel, control, value, status, group) var deck = MaudioXponent.getDeck(group); var cueNumber = control - 0x16; + var activate = (status == deck.on); - if (!deck.shift) { - var activate = (status == deck.on); - engine.setValue(group, "hotcue_" + cueNumber + "_activate", activate); - } else { - engine.setValue(group, "hotcue_" + cueNumber + "_clear", 1); + if (activate) { + if (!deck.shift) { + engine.setValue(group, "hotcue_" + cueNumber + "_activate", activate); + } else { + engine.setValue(group, "hotcue_" + cueNumber + "_clear", 1); + } } }; From 97d6c8990e1663c0219562aa87f90e3e5a403c08 Mon Sep 17 00:00:00 2001 From: Mel Grubb Date: Tue, 21 Mar 2017 22:50:57 -0400 Subject: [PATCH 19/20] Finalized effect focus system --- .../M-Audio Xponent (Advanced).midi.xml | 153 ++++++++++++++---- .../M-Audio-Xponent-Advanced-scripts.js | 148 ++++++++++------- 2 files changed, 211 insertions(+), 90 deletions(-) diff --git a/res/controllers/M-Audio Xponent (Advanced).midi.xml b/res/controllers/M-Audio Xponent (Advanced).midi.xml index 82111a52ad9d..bcdd2e77ab75 100644 --- a/res/controllers/M-Audio Xponent (Advanced).midi.xml +++ b/res/controllers/M-Audio Xponent (Advanced).midi.xml @@ -707,8 +707,8 @@ [Sampler1] - MaudioXponent.sampler - Sampler 1 Button Press + MaudioXponent.samplerButton + Sampler 1 Button Press (Bank A) 0x90 0x0C @@ -717,18 +717,40 @@ [Sampler1] - MaudioXponent.sampler - Sampler 1 Button Press + MaudioXponent.samplerButton + Sampler 1 Button Release (Bank A) + 0x80 + 0x0C + + + + + + + [Sampler1] + MaudioXponent.samplerButton + Sampler 1 Button Press (Bank B) 0x95 0x0C + + [Sampler1] + MaudioXponent.samplerButton + Sampler 1 Button Release (Bank B) + 0x85 + 0x0C + + + + + [Sampler1] pregain - Sampler 1 Knob + Sampler 1 Knob (Bank A) 0xB0 0x0C @@ -738,7 +760,7 @@ [Sampler1] pregain - Sampler 1 Knob + Sampler 1 Knob (Bank B) 0xB5 0x0C @@ -748,8 +770,8 @@ [Sampler2] - MaudioXponent.sampler - Sampler 2 Button Press + MaudioXponent.samplerButton + Sampler 2 Button Press (Bank A) 0x90 0x0D @@ -758,18 +780,40 @@ [Sampler2] - MaudioXponent.sampler - Sampler 2 Button Press + MaudioXponent.samplerButton + Sampler 2 Button Release (Bank A) + 0x80 + 0x0D + + + + + + + [Sampler2] + MaudioXponent.samplerButton + Sampler 2 Button Press (Bank B) 0x95 0x0D + + [Sampler2] + MaudioXponent.samplerButton + Sampler 2 Button Release (Bank B) + 0x85 + 0x0D + + + + + [Sampler2] pregain - Sampler 2 Knob + Sampler 2 Knob (Bank A) 0xB0 0x0D @@ -779,7 +823,7 @@ [Sampler2] pregain - Sampler 2 Knob + Sampler 2 Knob (Bank B) 0xB5 0x0D @@ -787,11 +831,10 @@ - [Sampler3] - MaudioXponent.sampler - Sampler 3 Button Press + MaudioXponent.samplerButton + Sampler 3 Button Press (Bank A) 0x90 0x0E @@ -800,18 +843,40 @@ [Sampler3] - MaudioXponent.sampler - Sampler 3 Button Press + MaudioXponent.samplerButton + Sampler 3 Button Release (Bank A) + 0x80 + 0x0E + + + + + + + [Sampler3] + MaudioXponent.samplerButton + Sampler 3 Button Press (Bank B) 0x95 0x0E + + [Sampler3] + MaudioXponent.samplerButton + Sampler 3 Button Release (Bank B) + 0x85 + 0x0E + + + + + [Sampler3] pregain - Sampler 3 Knob + Sampler 3 Knob (Bank A) 0xB0 0x0E @@ -821,7 +886,7 @@ [Sampler3] pregain - Sampler 3 Knob + Sampler 3 Knob (Bank B) 0xB5 0x0E @@ -831,8 +896,8 @@ [Sampler4] - MaudioXponent.sampler - Sampler 4 Button Press + MaudioXponent.samplerButton + Sampler 4 Button Press (Bank A) 0x90 0x0F @@ -841,18 +906,40 @@ [Sampler4] - MaudioXponent.sampler - Sampler 4 Button Press + MaudioXponent.samplerButton + Sampler 4 Button Release (Bank A) + 0x80 + 0x0F + + + + + + + [Sampler4] + MaudioXponent.samplerButton + Sampler 4 Button Press (Bank B) 0x95 0x0F + + [Sampler4] + MaudioXponent.samplerButton + Sampler 4 Button Relase (Bank B) + 0x85 + 0x0F + + + + + [Sampler4] pregain - Sampler 4 Knob + Sampler 4 Knob (Bank A) 0xB0 0x0F @@ -862,7 +949,7 @@ [Sampler4] pregain - Sampler 4 Knob + Sampler 4 Knob (Bank B) 0xB5 0x0F @@ -954,7 +1041,7 @@ [Channel2] - MaudioXponent.effectParameter + MaudioXponent.effectKnob Effect Parameter 1 Knob 0xB1 0x0C @@ -964,7 +1051,7 @@ [Channel2] - MaudioXponent.effectParameter + MaudioXponent.effectKnob Effect Parameter 2 Knob 0xB1 0x0D @@ -974,7 +1061,7 @@ [Channel2] - MaudioXponent.effectParameter + MaudioXponent.effectKnob Effect Parameter 3 Knob 0xB1 0x0E @@ -984,7 +1071,7 @@ [Channel2] - MaudioXponent.effectParameter + MaudioXponent.effectKnob Effect Parameter 4 Knob 0xB1 0x0F @@ -995,7 +1082,7 @@ [Channel4] - MaudioXponent.effectParameter + MaudioXponent.effectKnob Effect Parameter 1 Knob 0xB6 0x0C @@ -1005,7 +1092,7 @@ [Channel4] - MaudioXponent.effectParameter + MaudioXponent.effectKnob Effect Parameter 2 Knob 0xB6 0x0D @@ -1015,7 +1102,7 @@ [Channel4] - MaudioXponent.effectParameter + MaudioXponent.effectKnob Effect Parameter 3 Knob 0xB6 0x0E @@ -1025,7 +1112,7 @@ [Channel4] - MaudioXponent.effectParameter + MaudioXponent.effectKnob Effect Parameter 4 Knob 0xB6 0x0F diff --git a/res/controllers/M-Audio-Xponent-Advanced-scripts.js b/res/controllers/M-Audio-Xponent-Advanced-scripts.js index 4f20e70ab709..652a62e15c66 100644 --- a/res/controllers/M-Audio-Xponent-Advanced-scripts.js +++ b/res/controllers/M-Audio-Xponent-Advanced-scripts.js @@ -34,7 +34,7 @@ MaudioXponent.decks = MaudioXponent.state = { bank : 0, // Which position is the bank switch currently set to? faderPosition : 0, // Temporary storage for cross-fader position during punch-ins. - focusedEffectUnit : 0, // Which overall effect chain has the focus + focusedEffectUnit : 0, // Which effect chain has the focus, if any. plnumberpos : 0, plnumberneg : 0, }; @@ -105,7 +105,7 @@ MaudioXponent.init = function () { MaudioXponent.initDecks(); MaudioXponent.initLights(); MaudioXponent.syncLights(); - + MaudioXponent.syncEffects(); // MaudioXponent.probeLights(); }; @@ -296,7 +296,33 @@ MaudioXponent.syncLights = function() { engine.trigger(deck.group, "loop_out"); midi.sendShortMsg(deck.on, MaudioXponent.buttons.scratch, deck.scratchEnabled); - MaudioXponent.onPlayPositionChange(deck.playPosition, deck.group); + + var duration = engine.getValue(deck.group, "duration"); + deck.warnAt = (duration - 30) / parseFloat(duration); + engine.trigger(deck.group, "playposition"); + } +}; + +MaudioXponent.syncEffects = function() { + var deck = MaudioXponent.rightDeck; + + for (var i = 1; i <= 4; i++) { + var control = MaudioXponent.buttons.fx1 + i - 1; + var group = "[EffectRack1_EffectUnit" + i + "]"; + if (!deck.shift) { + // Show enabled effect units + var enabled = engine.getValue(group, "enabled"); + midi.sendShortMsg(deck.on, control, enabled); + engine.setValue(group, "show_focus", false); + } else { + // Show focused effect unit + var focused = MaudioXponent.state.focusedEffectUnit === i; + midi.sendShortMsg(deck.on, control, focused); + engine.setValue(group, "show_focus", focused); + if (!focused) { + engine.setValue(group, "focused_effect", focused); + } + } } }; @@ -343,6 +369,22 @@ MaudioXponent.bankSwitch = function(channel, control, value, status) { MaudioXponent.syncLights(); }; +MaudioXponent.shift = function(channel, control, value, status, group) { + // script.midiDebug(channel, control, value, status, group); + var deck = MaudioXponent.getDeck(group); + var activate = (status === deck.on); + + deck.shift = activate; + midi.sendShortMsg(deck.on, MaudioXponent.buttons.shift, activate); + + // Unfocus effects on shift release + if (!activate && MaudioXponent.state.focusedEffectUnit) { + MaudioXponent.state.focusedEffectUnit = 0; + } + + MaudioXponent.syncEffects(); +}; + MaudioXponent.beatsync = function(channel, control, value, status, group) { // script.midiDebug(channel, control, value, status, group); var deck = MaudioXponent.getDeck(group); @@ -431,60 +473,57 @@ MaudioXponent.effectButton = function(channel, control, value, status, group) { var deck = MaudioXponent.getDeck(group); var button = control - 0x0B; - if (deck.shift) { - // Focus/Unfocus EffectUnit - MaudioXponent.state.focusedEffectUnit = (button === MaudioXponent.state.focusedEffectUnit) ? 0 : button; - - // Light the focused effect - for (var i = 0; i < 4; i++) { - var ctrl = MaudioXponent.buttons.fx1 + i; - var newValue = (i + 1 === MaudioXponent.state.focusedEffectUnit) ? 1 : 0; - midi.sendShortMsg(deck.on, ctrl, newValue); - } - } else { + if (!deck.shift) { // Toggle EffectUnit group = "[EffectRack1_EffectUnit" + button + "]"; var effectEnabled = !engine.getValue(group, "enabled"); engine.setValue(group, "enabled", effectEnabled); + MaudioXponent.syncEffects(); + } else { + // Focus Effects + if (MaudioXponent.state.focusedEffectUnit === 0) { + // Focus EffectUnit + MaudioXponent.state.focusedEffectUnit = button; + MaudioXponent.syncEffects(); + } else { + group = "[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffectUnit + "]"; + var focusedEffect = engine.getValue(group, "focused_effect"); + if (focusedEffect === button) { + // Toggle focused Effect + group = "[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffectUnit + "_Effect" + focusedEffect + "]"; + var enabled = !engine.getValue(group, "enabled"); + engine.setValue(group, "enabled", enabled); + } else { + // Focus effect + engine.setValue(group, "focused_effect", button); + engine.setValue(group, "show_focus", true); + } + } } }; -MaudioXponent.effectParameter = function(channel, control, value, status, group) { - // script.midiDebug(channel, control, value, status, group); +MaudioXponent.effectKnob = function(channel, control, value) { var knob = control - 0x0B; var scaledValue = value / 0x7F; - if (MaudioXponent.state.focusedEffectUnit != 0) { + if (MaudioXponent.state.focusedEffectUnit === 0) { if (MaudioXponent.rightDeck.shift) { - // Manipulate focused EffectUnit parameters - if (knob == 4) { - // Wet / Dry - engine.setParameter("[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffectUnit + "]", "mix", scaledValue); - } else { - // Other parameter - engine.setParameter("[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffectUnit + "_Effect1]", "parameter" + knob, scaledValue); - } + // Manipulate Wet/Dry mix + engine.setParameter("[EffectRack1_EffectUnit" + knob + "]", "mix", scaledValue); } else { - // Manipulate focused EffectUnit meta/super knobs - if (knob == 4) { - // Super-knob - group = "[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffectUnit + "]"; - engine.setParameter(group, "super1", scaledValue); - } else { - // Meta-knob - group = "[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffectUnit + "_Effect" + knob + "]"; - engine.setParameter(group, "meta", scaledValue); - } + // Manipulate Unit Super-knobs + engine.setParameter("[EffectRack1_EffectUnit" + knob + "]", "super1", scaledValue); } } else { - if (MaudioXponent.rightDeck.shift) { - // Manipulate Wet/Dry mix - group = "[EffectRack1_EffectUnit" + knob + "]"; - engine.setParameter(group, "mix", scaledValue); + // An effect has focus + var focusedEffect = engine.getValue("[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffectUnit + "]", "focused_effect"); + + if (focusedEffect === 0) { + // Manipulate focused EffectUnit meta knobs + engine.setParameter("[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffectUnit + "_Effect" + knob + "]", "meta", scaledValue); } else { - // Manipulate Super-knobs - group = "[EffectRack1_EffectUnit" + knob + "]"; - engine.setParameter(group, "super1", scaledValue); + // Manipulate focused Effect parameters + engine.setParameter("[EffectRack1_EffectUnit" + MaudioXponent.state.focusedEffectUnit + "_Effect" + focusedEffect + "]", "parameter" + knob, scaledValue); } } }; @@ -565,9 +604,7 @@ MaudioXponent.onBpmChanged = function(/*value, group*/) { MaudioXponent.onPlayPositionChange = function(value, group) { var deck = MaudioXponent.getDeck(group); - value = engine.getValue(group, "playposition"); - deck.playPosition = value; if ((value < deck.warnAt) || (!deck.isPlaying()) || (value >= deck.warnAt && deck.beatState)) { midi.sendShortMsg(deck.progressMeterStatusByte, deck.progressMeterSecondByte, MaudioXponent.convert(value)); @@ -631,13 +668,6 @@ MaudioXponent.pitch = function(channel, control, value, status, group) { engine.setValue(group, "rate", script.midiPitch(control, value, status)); }; -MaudioXponent.shift = function(channel, control, value, status, group) { - // script.midiDebug(channel, control, value, status, group); - var deck = MaudioXponent.getDeck(group); - deck.shift = (status === deck.on); - midi.sendShortMsg(deck.on, MaudioXponent.buttons.shift, deck.shift); -}; - MaudioXponent.toggleScratchMode = function(channel, control, value, status, group) { // script.midiDebug(channel, control, value, status, group); var deck = MaudioXponent.getDeck(group); @@ -814,16 +844,20 @@ MaudioXponent.onReverse = function(value, group, control) { MaudioXponent.seek = function(channel, control, value, status, group) { // script.midiDebug(channel, control, value, status, group); var deck = MaudioXponent.getDeck(group); - var activate = (status == deck.on); + var activate = (status === deck.on); engine.setValue(group, MaudioXponent.controls[control], activate); }; -MaudioXponent.sampler = function(channel, control, value, status, group) { - // script.midiDebug(channel, control, value, status, group); - if (MaudioXponent.leftDeck.shift) { - engine.setValue(group, "cue_gotoandstop", 1); - } else { +MaudioXponent.samplerButton = function(channel, control, value, status, group) { + script.midiDebug(channel, control, value, status, group); + var activate = (status === MaudioXponent.leftDeck.on); + + if (activate) { + print("*** " + group + " cue_gotoandplay"); engine.setValue(group, "cue_gotoandplay", 1); + } else if (MaudioXponent.leftDeck.shift) { + print("*** " + group + " cue_gotoandstop"); + engine.setValue(group, "cue_gotoandstop", 1); } }; From 84261b52fcba02d666569c31e8421306cd4b9dfd Mon Sep 17 00:00:00 2001 From: Mel Grubb Date: Tue, 21 Mar 2017 22:57:44 -0400 Subject: [PATCH 20/20] disabled sampler debug messages --- res/controllers/M-Audio-Xponent-Advanced-scripts.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/res/controllers/M-Audio-Xponent-Advanced-scripts.js b/res/controllers/M-Audio-Xponent-Advanced-scripts.js index 652a62e15c66..f6a4f00ee198 100644 --- a/res/controllers/M-Audio-Xponent-Advanced-scripts.js +++ b/res/controllers/M-Audio-Xponent-Advanced-scripts.js @@ -849,14 +849,14 @@ MaudioXponent.seek = function(channel, control, value, status, group) { }; MaudioXponent.samplerButton = function(channel, control, value, status, group) { - script.midiDebug(channel, control, value, status, group); + //script.midiDebug(channel, control, value, status, group); var activate = (status === MaudioXponent.leftDeck.on); if (activate) { - print("*** " + group + " cue_gotoandplay"); + //print("*** " + group + " cue_gotoandplay"); engine.setValue(group, "cue_gotoandplay", 1); } else if (MaudioXponent.leftDeck.shift) { - print("*** " + group + " cue_gotoandstop"); + //print("*** " + group + " cue_gotoandstop"); engine.setValue(group, "cue_gotoandstop", 1); } };