From 9cfc1dad33eec9778ec951bebf100541fa8133b3 Mon Sep 17 00:00:00 2001
From: DJ Phatso <48333945+DJPhatso@users.noreply.github.com>
Date: Wed, 15 Feb 2023 13:07:26 -0500
Subject: [PATCH 1/8] Mapping files for Hercules DJControl MIX
Based on Hercules DJControl Starlight mapping released with Mixxx v2.3.0:
-Remapped LOOP and SAMPLER section according to DJControl MIX layout;
-Added Master Volume and Headphone Volume;
-Removed superfluous LED configuration (not present on DJControl MIX).
---
Hercules DJControl MIX.midi.xml | 1598 +++++++++++++++++++++++++++++
Hercules-DJControl-MIX-scripts.js | 220 ++++
2 files changed, 1818 insertions(+)
create mode 100644 Hercules DJControl MIX.midi.xml
create mode 100644 Hercules-DJControl-MIX-scripts.js
diff --git a/Hercules DJControl MIX.midi.xml b/Hercules DJControl MIX.midi.xml
new file mode 100644
index 00000000000..7676716c43b
--- /dev/null
+++ b/Hercules DJControl MIX.midi.xml
@@ -0,0 +1,1598 @@
+
+
+
+ Hercules DJControl MIX
+ DJ Phatso for Hercules Technical Support, contributions by Kerrick Staley
+ MIDI Preset for Hercules DJControl MIX
+ https://mixxx.discourse.group/t/hercules-contrl-mix-mapping/26581/
+ hercules_djcontrol_MIX
+
+
+
+
+
+
+
+
+
+ /****************************************************************************************************/
+ // NN's MIDI Channel 1 (0x91)
+ /****************************************************************************************************/
+
+ // Shift
+
+ [Master]
+ DJCMIX.shiftButton
+ Shift button
+ 0x90
+ 0x03
+
+
+
+
+
+ /****************************************************************************************************/
+ // NN's MIDI Channel 2 (0x91 Deck A - Standard MODE)
+ /****************************************************************************************************/
+
+ // Play
+
+ [Channel1]
+ play
+ Play button
+ 0x91
+ 0x07
+
+
+
+
+
+ // CUE
+
+ [Channel1]
+ cue_default
+ Cue button
+ 0x91
+ 0x06
+
+
+
+
+
+ // Sync
+
+ [Channel1]
+ sync_enabled
+ Sync button
+ 0x91
+ 0x05
+
+
+
+
+
+ // PFL
+
+ [Channel1]
+ pfl
+ PFL button
+ 0x91
+ 0x0C
+
+
+
+
+
+ // Vinyl button
+
+ [Master]
+ DJCMIX.vinylButton
+ Vinyl
+ 0x91
+ 0x03
+
+
+
+
+
+ // Jog wheel touch
+
+ [Channel1]
+ DJCMIX.wheelTouch
+ Jog Wheel Touch Deck A
+ 0x91
+ 0x08
+
+
+
+
+
+ /****************************************************************************************************/
+ // NN's MIDI Channel 3 (0x92 Deck B - Standard MODE)
+ /****************************************************************************************************/
+
+ // Play
+
+ [Channel2]
+ play
+ Play button
+ 0x92
+ 0x07
+
+
+
+
+
+ // CUE
+
+ [Channel2]
+ cue_default
+ Cue button
+ 0x92
+ 0x06
+
+
+
+
+
+ // Sync
+
+ [Channel2]
+ sync_enabled
+ Sync button
+ 0x92
+ 0x05
+
+
+
+
+
+ // PFL
+
+ [Channel2]
+ pfl
+ PFL button
+ 0x92
+ 0x0C
+
+
+
+
+
+ // Jog wheel touch
+
+ [Channel2]
+ DJCMIX.wheelTouch
+ Jog Wheel Touch Deck B
+ 0x92
+ 0x08
+
+
+
+
+
+ /****************************************************************************************************/
+ // NN's MIDI Channel 5 (0x94 Deck A - SHIFT MODE)
+ /****************************************************************************************************/
+
+ // Play
+
+ [Channel1]
+ play_stutter
+ SHIFT + Play: Play Stutter
+ 0x94
+ 0x07
+
+
+
+
+
+ // CUE
+
+ [Channel1]
+ start
+ SHIFT + Cue: REWIND to beginning
+ 0x94
+ 0x06
+
+
+
+
+
+ // Sync
+
+ [Channel1]
+ sync_master
+ SHIFT + Sync: Sync Master
+ 0x94
+ 0x05
+
+
+
+
+
+ // PFL
+
+ [Master]
+ DJCMIX.cueMaster
+ CUE Master
+ 0x94
+ 0x0C
+
+
+
+
+
+ // Jog wheel touch
+
+ [Channel1]
+ DJCMIX.wheelTouchShift
+ Jog Wheel Shift Touch Deck A
+ 0x94
+ 0x08
+
+
+
+
+
+ /****************************************************************************************************/
+ // NN's MIDI Channel 6 (0x95 Deck B - SHIFT MODE)
+ /****************************************************************************************************/
+
+ // Play
+
+ [Channel2]
+ play_stutter
+ SHIFT + Play: Play Stutter
+ 0x95
+ 0x07
+
+
+
+
+
+ // CUE
+
+ [Channel2]
+ start
+ SHIFT + Cue: REWIND to beginning
+ 0x95
+ 0x06
+
+
+
+
+
+ // Sync
+
+ [Channel2]
+ sync_master
+ SHIFT + Sync: Sync Master
+ 0x95
+ 0x05
+
+
+
+
+
+ // PFL
+
+ [Master]
+ DJCMIX.cueMix
+ Headphone CUE + MIX
+ 0x95
+ 0x0C
+
+
+
+
+
+ // Jog wheel touch
+
+ [Channel2]
+ DJCMIX.wheelTouchShift
+ Jog Wheel Shift Touch Deck B
+ 0x95
+ 0x08
+
+
+
+
+
+ /****************************************************************************************************/
+ // NN's MIDI Channel 7 (0x96 Deck A - Pads)
+ /****************************************************************************************************/
+
+ // Hot Cues (SET)
+
+ [Channel1]
+ hotcue_1_activate
+ PAD 1
+ 0x96
+ 0x00
+
+
+
+
+
+
+ [Channel1]
+ hotcue_2_activate
+ PAD 2
+ 0x96
+ 0x01
+
+
+
+
+
+
+ [Channel1]
+ hotcue_3_activate
+ PAD 3
+ 0x96
+ 0x02
+
+
+
+
+
+
+ [Channel1]
+ hotcue_4_activate
+ PAD 4
+ 0x96
+ 0x03
+
+
+
+
+
+ // Hot-Cue buttons (SHIFT mode)
+
+ [Channel1]
+ hotcue_1_clear
+ PAD 1
+ 0x96
+ 0x08
+
+
+
+
+
+
+ [Channel1]
+ hotcue_2_clear
+ PAD 2
+ 0x96
+ 0x09
+
+
+
+
+
+
+ [Channel1]
+ hotcue_3_clear
+ PAD 3
+ 0x96
+ 0x0A
+
+
+
+
+
+
+ [Channel1]
+ hotcue_4_clear
+ PAD 4
+ 0x96
+ 0x0B
+
+
+
+
+
+ // LOOP
+
+ [Channel1]
+ beatloop_1_toggle
+ Loop 1 Beat (Pad 1)
+ 0x96
+ 0x30
+
+
+
+
+
+
+ [Channel1]
+ beatloop_2_toggle
+ Loop 2 Beat (Pad 2)
+ 0x96
+ 0x31
+
+
+
+
+
+
+ [Channel1]
+ beatloop_4_toggle
+ Loop 4 Beat (Pad 3)
+ 0x96
+ 0x32
+
+
+
+
+
+
+ [Channel1]
+ beatloop_8_toggle
+ Loop 8 Beat (Pad 4)
+ 0x96
+ 0x33
+
+
+
+
+
+ // FX
+
+ [EffectRack1_EffectUnit1_Effect1]
+ enabled
+ (Pad 1)
+ 0x96
+ 0x20
+
+
+
+
+
+
+ [EffectRack1_EffectUnit1_Effect2]
+ enabled
+ (Pad 2)
+ 0x96
+ 0x21
+
+
+
+
+
+
+ [EffectRack1_EffectUnit1_Effect3]
+ enabled
+ (Pad 3)
+ 0x96
+ 0x22
+
+
+
+
+
+
+ [EffectRack1_EffectUnit1]
+ group_[Channel1]_enable
+ (Pad 4)
+ 0x96
+ 0x23
+
+
+
+
+
+
+ [EffectRack1_EffectUnit1_Effect1]
+ effect_selector
+ SHIFT + (Pad 1)
+ 0x96
+ 0x28
+
+
+
+
+
+
+ [EffectRack1_EffectUnit1_Effect2]
+ effect_selector
+ SHIFT + (Pad 2)
+ 0x96
+ 0x29
+
+
+
+
+
+
+ [EffectRack1_EffectUnit1_Effect3]
+ effect_selector
+ SHIFT + (Pad 3)
+ 0x96
+ 0x2A
+
+
+
+
+
+ // Sampler
+
+ [Sampler1]
+ cue_gotoandplay
+ PAD 1
+ 0x96
+ 0x10
+
+
+
+
+
+
+ [Sampler2]
+ cue_gotoandplay
+ PAD 2
+ 0x96
+ 0x11
+
+
+
+
+
+
+ [Sampler3]
+ cue_gotoandplay
+ PAD 3
+ 0x96
+ 0x12
+
+
+
+
+
+
+ [Sampler4]
+ cue_gotoandplay
+ PAD 4
+ 0x96
+ 0x13
+
+
+
+
+
+ /****************************************************************************************************/
+ // NN's MIDI Channel 8 (0x97 Deck B - Pads)
+ /****************************************************************************************************/
+
+ // Hot Cues (SET)
+
+ [Channel2]
+ hotcue_1_activate
+ PAD 1
+ 0x97
+ 0x00
+
+
+
+
+
+
+ [Channel2]
+ hotcue_2_activate
+ PAD 2
+ 0x97
+ 0x01
+
+
+
+
+
+
+ [Channel2]
+ hotcue_3_activate
+ PAD 3
+ 0x97
+ 0x02
+
+
+
+
+
+
+ [Channel2]
+ hotcue_4_activate
+ PAD 4
+ 0x97
+ 0x03
+
+
+
+
+
+ // Hot-Cue buttons (SHIFT mode)
+
+ [Channel2]
+ hotcue_1_clear
+ PAD 1
+ 0x97
+ 0x08
+
+
+
+
+
+
+ [Channel2]
+ hotcue_2_clear
+ PAD 2
+ 0x97
+ 0x09
+
+
+
+
+
+
+ [Channel2]
+ hotcue_3_clear
+ PAD 3
+ 0x97
+ 0x0A
+
+
+
+
+
+
+ [Channel2]
+ hotcue_4_clear
+ PAD 4
+ 0x97
+ 0x0B
+
+
+
+
+
+ // LOOP
+
+ [Channel2]
+ beatloop_1_toggle
+ Loop 1 Beat (Pad 1)
+ 0x97
+ 0x30
+
+
+
+
+
+
+ [Channel2]
+ beatloop_2_toggle
+ Loop 2 Beat (Pad 2)
+ 0x97
+ 0x31
+
+
+
+
+
+
+ [Channel2]
+ beatloop_4_toggle
+ Loop 4 Beat (Pad 3)
+ 0x97
+ 0x32
+
+
+
+
+
+
+ [Channel2]
+ beatloop_8_toggle
+ Loop 8 Beat (Pad 4)
+ 0x97
+ 0x33
+
+
+
+
+
+ // FX
+
+ [EffectRack1_EffectUnit2_Effect1]
+ enabled
+ (Pad 1)
+ 0x97
+ 0x20
+
+
+
+
+
+
+ [EffectRack1_EffectUnit2_Effect2]
+ enabled
+ (Pad 2)
+ 0x97
+ 0x21
+
+
+
+
+
+
+ [EffectRack1_EffectUnit2_Effect3]
+ enabled
+ (Pad 3)
+ 0x97
+ 0x22
+
+
+
+
+
+
+ [EffectRack1_EffectUnit2]
+ group_[Channel2]_enable
+ (Pad 4)
+ 0x97
+ 0x23
+
+
+
+
+
+
+ [EffectRack1_EffectUnit2_Effect1]
+ effect_selector
+ SHIFT +(Pad 1)
+ 0x97
+ 0x28
+
+
+
+
+
+
+ [EffectRack1_EffectUnit2_Effect2]
+ effect_selector
+ SHIFT +(Pad 2)
+ 0x97
+ 0x29
+
+
+
+
+
+
+ [EffectRack1_EffectUnit2_Effect3]
+ effect_selector
+ SHIFT +(Pad 3)
+ 0x97
+ 0x2A
+
+
+
+
+
+ // Sampler
+
+ [Sampler5]
+ cue_gotoandplay
+ PAD 1
+ 0x97
+ 0x10
+
+
+
+
+
+
+ [Sampler6]
+ cue_gotoandplay
+ PAD 2
+ 0x97
+ 0x11
+
+
+
+
+
+
+ [Sampler7]
+ cue_gotoandplay
+ PAD 3
+ 0x97
+ 0x12
+
+
+
+
+
+
+ [Sampler8]
+ cue_gotoandplay
+ PAD 4
+ 0x97
+ 0x13
+
+
+
+
+
+ /****************************************************************************************************/
+ // CC's MIDI Channel 1 (0xB0 Standard mode)
+ /***************************************************************************************************/
+
+ // Crossfader
+
+ [Master]
+ crossfader
+ Crossfader
+ 0xB0
+ 0x00
+
+
+
+
+
+ // Master Volume
+
+ [Master]
+ gain
+ Master Volume
+ 0xB0
+ 0x03
+
+
+
+
+
+ // Headphone Volume
+
+ [Master]
+ headGain
+ Headphone Volume
+ 0xB0
+ 0x04
+
+
+
+
+
+ /****************************************************************************************************/
+ // CC's MIDI Channel 2 (0xB1 Deck A - Standard mode)
+ /***************************************************************************************************/
+
+ // Volume
+
+ [Channel1]
+ volume
+ Volume Deck A
+ 0xB1
+ 0x00
+
+
+
+
+
+ // EQ
+
+ [EqualizerRack1_[Channel1]_Effect1]
+ parameter1
+ EQ LOW Deck A
+ 0xB1
+ 0x02
+
+
+
+
+
+ // Filter
+
+ [QuickEffectRack1_[Channel1]]
+ super1
+ Filter Deck A
+ 0xB1
+ 0x01
+
+
+
+
+
+ // Pitch slider
+
+ [Channel1]
+ rate
+ 0xB1
+ 0x08
+
+
+
+
+
+
+
+ [Channel1]
+ rate
+ 0xB1
+ 0x28
+
+
+
+
+
+
+ // Jog wheel
+
+ [Channel1]
+ DJCMIX.scratchWheel
+ Jog-Wheel Scratch (Held down)
+ 0xB1
+ 0x0A
+
+
+
+
+
+
+ [Channel1]
+ DJCMIX.scratchWheelShift
+ Jog-Wheel Seek (Held down + Shift)
+ 0xB4
+ 0x0A
+
+
+
+
+
+
+ [Channel1]
+ DJCMIX.bendWheel
+ Jog-Wheel Pitch Bend
+ 0xB1
+ 0x09
+
+
+
+
+
+ /****************************************************************************************************/
+ // CC's MIDI Channel 3 (0xB2 Deck B - Standard mode)
+ /***************************************************************************************************/
+
+ // Volume
+
+ [Channel2]
+ volume
+ Volume Deck A
+ 0xB2
+ 0x00
+
+
+
+
+
+ // EQ
+
+ [EqualizerRack1_[Channel2]_Effect1]
+ parameter1
+ EQ LOW Deck B
+ 0xB2
+ 0x02
+
+
+
+
+
+ // Filter
+
+ [QuickEffectRack1_[Channel2]]
+ super1
+ Filter Deck A
+ 0xB2
+ 0x01
+
+
+
+
+
+ // Pitch slider
+
+ [Channel2]
+ rate
+ 0xB2
+ 0x08
+
+
+
+
+
+
+
+ [Channel2]
+ rate
+ 0xB2
+ 0x28
+
+
+
+
+
+
+ // Jog wheel
+
+ [Channel2]
+ DJCMIX.scratchWheel
+ Jog-Wheel Scratch (Held down)
+ 0xB2
+ 0x0A
+
+
+
+
+
+
+ [Channel1]
+ DJCMIX.scratchWheelShift
+ Jog-Wheel Seek (Held down + Shift)
+ 0xB5
+ 0x0A
+
+
+
+
+
+
+ [Channel2]
+ DJCMIX.bendWheel
+ Jog-Wheel Pitch Bend
+ 0xB2
+ 0x09
+
+
+
+
+
+
+
+ /****************************************************************************************************/
+ //LED output
+ /***************************************************************************************************/
+
+
+
+ // LED Transport
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ // LED PFL buttons
+
+
+
+
+ // LED HOT CUE (Normal Mode)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ // LED HOT CUE (SHIFT Mode)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ // LED LOOP
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ // FX
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ // LED SAMPLE
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Hercules-DJControl-MIX-scripts.js b/Hercules-DJControl-MIX-scripts.js
new file mode 100644
index 00000000000..07a7d56eddd
--- /dev/null
+++ b/Hercules-DJControl-MIX-scripts.js
@@ -0,0 +1,220 @@
+var DJCMIX = {};
+///////////////////////////////////////////////////////////////
+// USER OPTIONS //
+///////////////////////////////////////////////////////////////
+
+// How fast scratching is.
+DJCMIX.scratchScale = 1.0;
+
+// How much faster seeking (shift+scratch) is than scratching.
+DJCMIX.scratchShiftMultiplier = 4;
+
+// How fast bending is.
+DJCMIX.bendScale = 1.0;
+
+// DJControl_MIX_scripts.js
+//
+// ****************************************************************************
+// * Mixxx mapping script file for the Hercules DJControl MIX.
+// * Author: DJ Phatso and Kerrick Staley
+// * Version 1 (Jan 2023)
+// * Based on Hercules DJControl Starlight mapping released with Mixxx v2.3.0
+// * -Remapped LOOP and SAMPLER section according to DJControl MIX layout
+// * -Added Master Volume and Headphone Volume
+// * -Removed superfluous LED configuration (not present on DJControl MIX)
+// * Forum: https://mixxx.discourse.group/t/hercules-contrl-mix-mapping/26581/
+// * Wiki: https://mixxx.org/wiki/doku.php/
+
+
+DJCMIX.kScratchActionNone = 0;
+DJCMIX.kScratchActionScratch = 1;
+DJCMIX.kScratchActionSeek = 2;
+DJCMIX.kScratchActionBend = 3;
+
+
+DJCMIX.init = function() {
+ DJCMIX.scratchButtonState = true;
+ DJCMIX.scratchAction = {
+ 1: DJCMIX.kScratchActionNone,
+ 2: DJCMIX.kScratchActionNone};
+
+ // Vinyl button LED On.
+ midi.sendShortMsg(0x91, 0x03, 0x7F);
+
+ // Set effects Levels - Dry/Wet
+ engine.setParameter("[EffectRack1_EffectUnit1_Effect1]", "meta", 0.6);
+ engine.setParameter("[EffectRack1_EffectUnit1_Effect2]", "meta", 0.6);
+ engine.setParameter("[EffectRack1_EffectUnit1_Effect3]", "meta", 0.6);
+ engine.setParameter("[EffectRack1_EffectUnit2_Effect1]", "meta", 0.6);
+ engine.setParameter("[EffectRack1_EffectUnit2_Effect2]", "meta", 0.6);
+ engine.setParameter("[EffectRack1_EffectUnit2_Effect3]", "meta", 0.6);
+ engine.setParameter("[EffectRack1_EffectUnit1]", "mix", 1);
+ engine.setParameter("[EffectRack1_EffectUnit2]", "mix", 1);
+
+ // Ask the controller to send all current knob/slider values over MIDI, which will update
+ // the corresponding GUI controls in MIXXX.
+ midi.sendShortMsg(0xB0, 0x7F, 0x7F);
+};
+
+// The Vinyl button, used to enable or disable scratching on the jog wheels (The Vinyl button enables both deck).
+DJCMIX.vinylButton = function(channel, control, value, status, group) {
+ if (value) {
+ if (DJCMIX.scratchButtonState) {
+ DJCMIX.scratchButtonState = false;
+ midi.sendShortMsg(0x91,0x03,0x00);
+
+ } else {
+ DJCMIX.scratchButtonState = true;
+ midi.sendShortMsg(0x91,0x03,0x7F);
+ }
+ }
+};
+
+DJCMIX._scratchEnable = function(deck) {
+ var alpha = 1.0/8;
+ var beta = alpha/32;
+ engine.scratchEnable(deck, 248, 33 + 1/3, alpha, beta);
+};
+
+DJCMIX._convertWheelRotation = function(value) {
+ // When you rotate the jogwheel, the controller always sends either 0x1
+ // (clockwise) or 0x7F (counter clockwise). 0x1 should map to 1, 0x7F
+ // should map to -1 (IOW it's 7-bit signed).
+ return value < 0x40 ? 1 : -1;
+}
+
+// The touch action on the jog wheel's top surface
+DJCMIX.wheelTouch = function(channel, control, value, status, group) {
+ var deck = channel;
+ if (value > 0) {
+ // Touching the wheel.
+ if (engine.getValue("[Channel" + deck + "]", "play") !== 1 || DJCMIX.scratchButtonState) {
+ DJCMIX._scratchEnable(deck);
+ DJCMIX.scratchAction[deck] = DJCMIX.kScratchActionScratch;
+ } else {
+ DJCMIX.scratchAction[deck] = DJCMIX.kScratchActionBend;
+ }
+ } else {
+ // Released the wheel.
+ engine.scratchDisable(deck);
+ DJCMIX.scratchAction[deck] = DJCMIX.kScratchActionNone;
+ }
+};
+
+// The touch action on the jog wheel's top surface while holding shift
+DJCMIX.wheelTouchShift = function(channel, control, value, status, group) {
+ var deck = channel - 3;
+ // We always enable scratching regardless of button state.
+ if (value > 0) {
+ DJCMIX._scratchEnable(deck);
+ DJCMIX.scratchAction[deck] = DJCMIX.kScratchActionSeek;
+ } else {
+ // Released the wheel.
+ engine.scratchDisable(deck);
+ DJCMIX.scratchAction[deck] = DJCMIX.kScratchActionNone;
+ }
+};
+
+// Scratching on the jog wheel (rotating it while pressing the top surface)
+DJCMIX._scratchWheelImpl = function(deck, value) {
+ var interval = DJCMIX._convertWheelRotation(value);
+ var scratchAction = DJCMIX.scratchAction[deck];
+
+ if (scratchAction == DJCMIX.kScratchActionScratch) {
+ engine.scratchTick(deck, interval * DJCMIX.scratchScale);
+ } else if (scratchAction == DJCMIX.kScratchActionSeek) {
+ engine.scratchTick(deck,
+ interval
+ * DJCMIX.scratchScale
+ * DJCMIX.scratchShiftMultiplier);
+ } else {
+ DJCMIX._bendWheelImpl(deck, value);
+ }
+};
+
+// Scratching on the jog wheel (rotating it while pressing the top surface)
+DJCMIX.scratchWheel = function(channel, control, value, status, group) {
+ var deck = channel;
+ DJCMIX._scratchWheelImpl(deck, value);
+};
+
+// Seeking on the jog wheel (rotating it while pressing the top surface and holding Shift)
+DJCMIX.scratchWheelShift = function(channel, control, value, status, group) {
+ var deck = channel - 3;
+ DJCMIX._scratchWheelImpl(deck, value);
+};
+
+DJCMIX._bendWheelImpl = function(deck, value) {
+ var interval = DJCMIX._convertWheelRotation(value);
+ engine.setValue('[Channel' + deck + ']', 'jog',
+ interval * DJCMIX.bendScale);
+};
+
+// Bending on the jog wheel (rotating using the edge)
+DJCMIX.bendWheel = function(channel, control, value, status, group) {
+ var deck = channel;
+ DJCMIX._bendWheelImpl(deck, value);
+};
+
+// Cue master button
+DJCMIX.cueMaster = function(channel, control, value, status, group) {
+ // This button acts as a toggle. Ignore the release.
+ if (value === 0) {
+ return;
+ }
+
+ var masterIsCued = engine.getValue('[Master]', 'headMix') > 0;
+ // Toggle state.
+ masterIsCued = !masterIsCued;
+
+ var headMixValue = masterIsCued ? 1 : -1;
+ engine.setValue('[Master]', 'headMix', headMixValue);
+
+ // Set LED (will be overwritten when [Shift] is released)
+ var cueMasterLedValue = masterIsCued ? 0x7F : 0x00;
+ midi.sendShortMsg(0x91, 0x0C, cueMasterLedValue);
+};
+
+// Cue mix button, toggles PFL / master split feature
+// We need a special function for this because we want to turn on the LED (but
+// we *don't* want to turn on the LED when the user clicks the headSplit button
+// in the GUI).
+DJCMIX.cueMix = function(channel, control, value, status, group) {
+ // This button acts as a toggle. Ignore the release.
+ if (value === 0) {
+ return;
+ }
+
+ // Toggle state.
+ script.toggleControl('[Master]', 'headSplit');
+
+ // Set LED (will be overwritten when [Shift] is released)
+ var cueMixLedValue =
+ engine.getValue('[Master]', 'headSplit') ? 0x7F : 0x00;
+ midi.sendShortMsg(0x92, 0x0C, cueMixLedValue);
+};
+
+DJCMIX.shiftButton = function(channel, control, value, status, group) {
+ if (value >= 0x40) {
+ // When Shift is held, light the LEDS to show the status of the alt
+ // functions of the cue buttons.
+ var cueMasterLedValue =
+ engine.getValue('[Master]', 'headMix') > 0 ? 0x7F : 0x00;
+ midi.sendShortMsg(0x91, 0x0C, cueMasterLedValue);
+ var cueMixLedValue =
+ engine.getValue('[Master]', 'headSplit') ? 0x7F : 0x00;
+ midi.sendShortMsg(0x92, 0x0C, cueMixLedValue);
+ } else {
+ // When Shift is released, go back to the normal LED values.
+ var cueChan1LedValue =
+ engine.getValue('[Channel1]', 'pfl') ? 0x7F : 0x00;
+ midi.sendShortMsg(0x91, 0x0C, cueChan1LedValue);
+ var cueChan2LedValue =
+ engine.getValue('[Channel2]', 'pfl') ? 0x7F : 0x00;
+ midi.sendShortMsg(0x92, 0x0C, cueChan2LedValue);
+ }
+};
+
+DJCMIX.shutdown = function() {
+ midi.sendShortMsg(0xB0, 0x7F, 0x00);
+};
From 0e497f2170a060f790d03581a45da3ce5aebfc56 Mon Sep 17 00:00:00 2001
From: DJ Phatso <48333945+DJPhatso@users.noreply.github.com>
Date: Fri, 17 Feb 2023 11:01:32 -0500
Subject: [PATCH 2/8] reload of script file following pre-commit patch
---
Hercules-DJControl-MIX-scripts.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Hercules-DJControl-MIX-scripts.js b/Hercules-DJControl-MIX-scripts.js
index 07a7d56eddd..0f96e280fd5 100644
--- a/Hercules-DJControl-MIX-scripts.js
+++ b/Hercules-DJControl-MIX-scripts.js
@@ -217,4 +217,4 @@ DJCMIX.shiftButton = function(channel, control, value, status, group) {
DJCMIX.shutdown = function() {
midi.sendShortMsg(0xB0, 0x7F, 0x00);
-};
+};
\ No newline at end of file
From f6d16a62cee108e38cb29c98e86addfae704e5db Mon Sep 17 00:00:00 2001
From: Swiftb0y <12380386+Swiftb0y@users.noreply.github.com>
Date: Thu, 23 Mar 2023 17:09:43 +0100
Subject: [PATCH 3/8] move hercules djcontrol mix scripts into correct
directory
---
.../controllers/Hercules DJControl MIX.midi.xml | 0
.../controllers/Hercules-DJControl-MIX-scripts.js | 0
2 files changed, 0 insertions(+), 0 deletions(-)
rename Hercules DJControl MIX.midi.xml => res/controllers/Hercules DJControl MIX.midi.xml (100%)
rename Hercules-DJControl-MIX-scripts.js => res/controllers/Hercules-DJControl-MIX-scripts.js (100%)
diff --git a/Hercules DJControl MIX.midi.xml b/res/controllers/Hercules DJControl MIX.midi.xml
similarity index 100%
rename from Hercules DJControl MIX.midi.xml
rename to res/controllers/Hercules DJControl MIX.midi.xml
diff --git a/Hercules-DJControl-MIX-scripts.js b/res/controllers/Hercules-DJControl-MIX-scripts.js
similarity index 100%
rename from Hercules-DJControl-MIX-scripts.js
rename to res/controllers/Hercules-DJControl-MIX-scripts.js
From c8502a91b566e5b67ab4889d09bce41dbaa38e6c Mon Sep 17 00:00:00 2001
From: Swiftb0y <12380386+Swiftb0y@users.noreply.github.com>
Date: Thu, 23 Mar 2023 17:13:53 +0100
Subject: [PATCH 4/8] fix linter issues
---
.../Hercules-DJControl-MIX-scripts.js | 442 +++++++++---------
1 file changed, 222 insertions(+), 220 deletions(-)
diff --git a/res/controllers/Hercules-DJControl-MIX-scripts.js b/res/controllers/Hercules-DJControl-MIX-scripts.js
index 0f96e280fd5..9342cd9ec2f 100644
--- a/res/controllers/Hercules-DJControl-MIX-scripts.js
+++ b/res/controllers/Hercules-DJControl-MIX-scripts.js
@@ -1,220 +1,222 @@
-var DJCMIX = {};
-///////////////////////////////////////////////////////////////
-// USER OPTIONS //
-///////////////////////////////////////////////////////////////
-
-// How fast scratching is.
-DJCMIX.scratchScale = 1.0;
-
-// How much faster seeking (shift+scratch) is than scratching.
-DJCMIX.scratchShiftMultiplier = 4;
-
-// How fast bending is.
-DJCMIX.bendScale = 1.0;
-
-// DJControl_MIX_scripts.js
-//
-// ****************************************************************************
-// * Mixxx mapping script file for the Hercules DJControl MIX.
-// * Author: DJ Phatso and Kerrick Staley
-// * Version 1 (Jan 2023)
-// * Based on Hercules DJControl Starlight mapping released with Mixxx v2.3.0
-// * -Remapped LOOP and SAMPLER section according to DJControl MIX layout
-// * -Added Master Volume and Headphone Volume
-// * -Removed superfluous LED configuration (not present on DJControl MIX)
-// * Forum: https://mixxx.discourse.group/t/hercules-contrl-mix-mapping/26581/
-// * Wiki: https://mixxx.org/wiki/doku.php/
-
-
-DJCMIX.kScratchActionNone = 0;
-DJCMIX.kScratchActionScratch = 1;
-DJCMIX.kScratchActionSeek = 2;
-DJCMIX.kScratchActionBend = 3;
-
-
-DJCMIX.init = function() {
- DJCMIX.scratchButtonState = true;
- DJCMIX.scratchAction = {
- 1: DJCMIX.kScratchActionNone,
- 2: DJCMIX.kScratchActionNone};
-
- // Vinyl button LED On.
- midi.sendShortMsg(0x91, 0x03, 0x7F);
-
- // Set effects Levels - Dry/Wet
- engine.setParameter("[EffectRack1_EffectUnit1_Effect1]", "meta", 0.6);
- engine.setParameter("[EffectRack1_EffectUnit1_Effect2]", "meta", 0.6);
- engine.setParameter("[EffectRack1_EffectUnit1_Effect3]", "meta", 0.6);
- engine.setParameter("[EffectRack1_EffectUnit2_Effect1]", "meta", 0.6);
- engine.setParameter("[EffectRack1_EffectUnit2_Effect2]", "meta", 0.6);
- engine.setParameter("[EffectRack1_EffectUnit2_Effect3]", "meta", 0.6);
- engine.setParameter("[EffectRack1_EffectUnit1]", "mix", 1);
- engine.setParameter("[EffectRack1_EffectUnit2]", "mix", 1);
-
- // Ask the controller to send all current knob/slider values over MIDI, which will update
- // the corresponding GUI controls in MIXXX.
- midi.sendShortMsg(0xB0, 0x7F, 0x7F);
-};
-
-// The Vinyl button, used to enable or disable scratching on the jog wheels (The Vinyl button enables both deck).
-DJCMIX.vinylButton = function(channel, control, value, status, group) {
- if (value) {
- if (DJCMIX.scratchButtonState) {
- DJCMIX.scratchButtonState = false;
- midi.sendShortMsg(0x91,0x03,0x00);
-
- } else {
- DJCMIX.scratchButtonState = true;
- midi.sendShortMsg(0x91,0x03,0x7F);
- }
- }
-};
-
-DJCMIX._scratchEnable = function(deck) {
- var alpha = 1.0/8;
- var beta = alpha/32;
- engine.scratchEnable(deck, 248, 33 + 1/3, alpha, beta);
-};
-
-DJCMIX._convertWheelRotation = function(value) {
- // When you rotate the jogwheel, the controller always sends either 0x1
- // (clockwise) or 0x7F (counter clockwise). 0x1 should map to 1, 0x7F
- // should map to -1 (IOW it's 7-bit signed).
- return value < 0x40 ? 1 : -1;
-}
-
-// The touch action on the jog wheel's top surface
-DJCMIX.wheelTouch = function(channel, control, value, status, group) {
- var deck = channel;
- if (value > 0) {
- // Touching the wheel.
- if (engine.getValue("[Channel" + deck + "]", "play") !== 1 || DJCMIX.scratchButtonState) {
- DJCMIX._scratchEnable(deck);
- DJCMIX.scratchAction[deck] = DJCMIX.kScratchActionScratch;
- } else {
- DJCMIX.scratchAction[deck] = DJCMIX.kScratchActionBend;
- }
- } else {
- // Released the wheel.
- engine.scratchDisable(deck);
- DJCMIX.scratchAction[deck] = DJCMIX.kScratchActionNone;
- }
-};
-
-// The touch action on the jog wheel's top surface while holding shift
-DJCMIX.wheelTouchShift = function(channel, control, value, status, group) {
- var deck = channel - 3;
- // We always enable scratching regardless of button state.
- if (value > 0) {
- DJCMIX._scratchEnable(deck);
- DJCMIX.scratchAction[deck] = DJCMIX.kScratchActionSeek;
- } else {
- // Released the wheel.
- engine.scratchDisable(deck);
- DJCMIX.scratchAction[deck] = DJCMIX.kScratchActionNone;
- }
-};
-
-// Scratching on the jog wheel (rotating it while pressing the top surface)
-DJCMIX._scratchWheelImpl = function(deck, value) {
- var interval = DJCMIX._convertWheelRotation(value);
- var scratchAction = DJCMIX.scratchAction[deck];
-
- if (scratchAction == DJCMIX.kScratchActionScratch) {
- engine.scratchTick(deck, interval * DJCMIX.scratchScale);
- } else if (scratchAction == DJCMIX.kScratchActionSeek) {
- engine.scratchTick(deck,
- interval
- * DJCMIX.scratchScale
- * DJCMIX.scratchShiftMultiplier);
- } else {
- DJCMIX._bendWheelImpl(deck, value);
- }
-};
-
-// Scratching on the jog wheel (rotating it while pressing the top surface)
-DJCMIX.scratchWheel = function(channel, control, value, status, group) {
- var deck = channel;
- DJCMIX._scratchWheelImpl(deck, value);
-};
-
-// Seeking on the jog wheel (rotating it while pressing the top surface and holding Shift)
-DJCMIX.scratchWheelShift = function(channel, control, value, status, group) {
- var deck = channel - 3;
- DJCMIX._scratchWheelImpl(deck, value);
-};
-
-DJCMIX._bendWheelImpl = function(deck, value) {
- var interval = DJCMIX._convertWheelRotation(value);
- engine.setValue('[Channel' + deck + ']', 'jog',
- interval * DJCMIX.bendScale);
-};
-
-// Bending on the jog wheel (rotating using the edge)
-DJCMIX.bendWheel = function(channel, control, value, status, group) {
- var deck = channel;
- DJCMIX._bendWheelImpl(deck, value);
-};
-
-// Cue master button
-DJCMIX.cueMaster = function(channel, control, value, status, group) {
- // This button acts as a toggle. Ignore the release.
- if (value === 0) {
- return;
- }
-
- var masterIsCued = engine.getValue('[Master]', 'headMix') > 0;
- // Toggle state.
- masterIsCued = !masterIsCued;
-
- var headMixValue = masterIsCued ? 1 : -1;
- engine.setValue('[Master]', 'headMix', headMixValue);
-
- // Set LED (will be overwritten when [Shift] is released)
- var cueMasterLedValue = masterIsCued ? 0x7F : 0x00;
- midi.sendShortMsg(0x91, 0x0C, cueMasterLedValue);
-};
-
-// Cue mix button, toggles PFL / master split feature
-// We need a special function for this because we want to turn on the LED (but
-// we *don't* want to turn on the LED when the user clicks the headSplit button
-// in the GUI).
-DJCMIX.cueMix = function(channel, control, value, status, group) {
- // This button acts as a toggle. Ignore the release.
- if (value === 0) {
- return;
- }
-
- // Toggle state.
- script.toggleControl('[Master]', 'headSplit');
-
- // Set LED (will be overwritten when [Shift] is released)
- var cueMixLedValue =
- engine.getValue('[Master]', 'headSplit') ? 0x7F : 0x00;
- midi.sendShortMsg(0x92, 0x0C, cueMixLedValue);
-};
-
-DJCMIX.shiftButton = function(channel, control, value, status, group) {
- if (value >= 0x40) {
- // When Shift is held, light the LEDS to show the status of the alt
- // functions of the cue buttons.
- var cueMasterLedValue =
- engine.getValue('[Master]', 'headMix') > 0 ? 0x7F : 0x00;
- midi.sendShortMsg(0x91, 0x0C, cueMasterLedValue);
- var cueMixLedValue =
- engine.getValue('[Master]', 'headSplit') ? 0x7F : 0x00;
- midi.sendShortMsg(0x92, 0x0C, cueMixLedValue);
- } else {
- // When Shift is released, go back to the normal LED values.
- var cueChan1LedValue =
- engine.getValue('[Channel1]', 'pfl') ? 0x7F : 0x00;
- midi.sendShortMsg(0x91, 0x0C, cueChan1LedValue);
- var cueChan2LedValue =
- engine.getValue('[Channel2]', 'pfl') ? 0x7F : 0x00;
- midi.sendShortMsg(0x92, 0x0C, cueChan2LedValue);
- }
-};
-
-DJCMIX.shutdown = function() {
- midi.sendShortMsg(0xB0, 0x7F, 0x00);
-};
\ No newline at end of file
+// eslint-disable-next-line no-var
+var DJCMIX = {};
+///////////////////////////////////////////////////////////////
+// USER OPTIONS //
+///////////////////////////////////////////////////////////////
+
+// How fast scratching is.
+DJCMIX.scratchScale = 1.0;
+
+// How much faster seeking (shift+scratch) is than scratching.
+DJCMIX.scratchShiftMultiplier = 4;
+
+// How fast bending is.
+DJCMIX.bendScale = 1.0;
+
+// DJControl_MIX_scripts.js
+//
+// ****************************************************************************
+// * Mixxx mapping script file for the Hercules DJControl MIX.
+// * Author: DJ Phatso and Kerrick Staley
+// * Version 1 (Jan 2023)
+// * Based on Hercules DJControl Starlight mapping released with Mixxx v2.3.0
+// * -Remapped LOOP and SAMPLER section according to DJControl MIX layout
+// * -Added Master Volume and Headphone Volume
+// * -Removed superfluous LED configuration (not present on DJControl MIX)
+// * Forum: https://mixxx.discourse.group/t/hercules-contrl-mix-mapping/26581/
+// * Wiki: https://mixxx.org/wiki/doku.php/
+
+
+DJCMIX.kScratchActionNone = 0;
+DJCMIX.kScratchActionScratch = 1;
+DJCMIX.kScratchActionSeek = 2;
+DJCMIX.kScratchActionBend = 3;
+
+
+DJCMIX.init = function() {
+ DJCMIX.scratchButtonState = true;
+ DJCMIX.scratchAction = {
+ 1: DJCMIX.kScratchActionNone,
+ 2: DJCMIX.kScratchActionNone
+ };
+
+ // Vinyl button LED On.
+ midi.sendShortMsg(0x91, 0x03, 0x7F);
+
+ // Set effects Levels - Dry/Wet
+ engine.setParameter("[EffectRack1_EffectUnit1_Effect1]", "meta", 0.6);
+ engine.setParameter("[EffectRack1_EffectUnit1_Effect2]", "meta", 0.6);
+ engine.setParameter("[EffectRack1_EffectUnit1_Effect3]", "meta", 0.6);
+ engine.setParameter("[EffectRack1_EffectUnit2_Effect1]", "meta", 0.6);
+ engine.setParameter("[EffectRack1_EffectUnit2_Effect2]", "meta", 0.6);
+ engine.setParameter("[EffectRack1_EffectUnit2_Effect3]", "meta", 0.6);
+ engine.setParameter("[EffectRack1_EffectUnit1]", "mix", 1);
+ engine.setParameter("[EffectRack1_EffectUnit2]", "mix", 1);
+
+ // Ask the controller to send all current knob/slider values over MIDI, which will update
+ // the corresponding GUI controls in MIXXX.
+ midi.sendShortMsg(0xB0, 0x7F, 0x7F);
+};
+
+// The Vinyl button, used to enable or disable scratching on the jog wheels (The Vinyl button enables both deck).
+DJCMIX.vinylButton = function(_channel, _control, value, _status, _group) {
+ if (value) {
+ if (DJCMIX.scratchButtonState) {
+ DJCMIX.scratchButtonState = false;
+ midi.sendShortMsg(0x91, 0x03, 0x00);
+
+ } else {
+ DJCMIX.scratchButtonState = true;
+ midi.sendShortMsg(0x91, 0x03, 0x7F);
+ }
+ }
+};
+
+DJCMIX._scratchEnable = function(deck) {
+ const alpha = 1.0/8;
+ const beta = alpha/32;
+ engine.scratchEnable(deck, 248, 33 + 1/3, alpha, beta);
+};
+
+DJCMIX._convertWheelRotation = function(value) {
+ // When you rotate the jogwheel, the controller always sends either 0x1
+ // (clockwise) or 0x7F (counter clockwise). 0x1 should map to 1, 0x7F
+ // should map to -1 (IOW it's 7-bit signed).
+ return value < 0x40 ? 1 : -1;
+};
+
+// The touch action on the jog wheel's top surface
+DJCMIX.wheelTouch = function(channel, _control, value, _status, _group) {
+ const deck = channel;
+ if (value > 0) {
+ // Touching the wheel.
+ if (engine.getValue("[Channel" + deck + "]", "play") !== 1 || DJCMIX.scratchButtonState) {
+ DJCMIX._scratchEnable(deck);
+ DJCMIX.scratchAction[deck] = DJCMIX.kScratchActionScratch;
+ } else {
+ DJCMIX.scratchAction[deck] = DJCMIX.kScratchActionBend;
+ }
+ } else {
+ // Released the wheel.
+ engine.scratchDisable(deck);
+ DJCMIX.scratchAction[deck] = DJCMIX.kScratchActionNone;
+ }
+};
+
+// The touch action on the jog wheel's top surface while holding shift
+DJCMIX.wheelTouchShift = function(channel, _control, value, _status, _group) {
+ const deck = channel - 3;
+ // We always enable scratching regardless of button state.
+ if (value > 0) {
+ DJCMIX._scratchEnable(deck);
+ DJCMIX.scratchAction[deck] = DJCMIX.kScratchActionSeek;
+ } else {
+ // Released the wheel.
+ engine.scratchDisable(deck);
+ DJCMIX.scratchAction[deck] = DJCMIX.kScratchActionNone;
+ }
+};
+
+// Scratching on the jog wheel (rotating it while pressing the top surface)
+DJCMIX._scratchWheelImpl = function(deck, value) {
+ const interval = DJCMIX._convertWheelRotation(value);
+ const scratchAction = DJCMIX.scratchAction[deck];
+
+ if (scratchAction === DJCMIX.kScratchActionScratch) {
+ engine.scratchTick(deck, interval * DJCMIX.scratchScale);
+ } else if (scratchAction === DJCMIX.kScratchActionSeek) {
+ engine.scratchTick(deck,
+ interval
+ * DJCMIX.scratchScale
+ * DJCMIX.scratchShiftMultiplier);
+ } else {
+ DJCMIX._bendWheelImpl(deck, value);
+ }
+};
+
+// Scratching on the jog wheel (rotating it while pressing the top surface)
+DJCMIX.scratchWheel = function(channel, _control, value, _status, _group) {
+ const deck = channel;
+ DJCMIX._scratchWheelImpl(deck, value);
+};
+
+// Seeking on the jog wheel (rotating it while pressing the top surface and holding Shift)
+DJCMIX.scratchWheelShift = function(channel, _control, value, _status, _group) {
+ const deck = channel - 3;
+ DJCMIX._scratchWheelImpl(deck, value);
+};
+
+DJCMIX._bendWheelImpl = function(deck, value) {
+ const interval = DJCMIX._convertWheelRotation(value);
+ engine.setValue("[Channel" + deck + "]", "jog",
+ interval * DJCMIX.bendScale);
+};
+
+// Bending on the jog wheel (rotating using the edge)
+DJCMIX.bendWheel = function(channel, _control, value, _status, _group) {
+ const deck = channel;
+ DJCMIX._bendWheelImpl(deck, value);
+};
+
+// Cue master button
+DJCMIX.cueMaster = function(_channel, _control, value, _status, _group) {
+ // This button acts as a toggle. Ignore the release.
+ if (value === 0) {
+ return;
+ }
+
+ let masterIsCued = engine.getValue("[Master]", "headMix") > 0;
+ // Toggle state.
+ masterIsCued = !masterIsCued;
+
+ const headMixValue = masterIsCued ? 1 : -1;
+ engine.setValue("[Master]", "headMix", headMixValue);
+
+ // Set LED (will be overwritten when [Shift] is released)
+ const cueMasterLedValue = masterIsCued ? 0x7F : 0x00;
+ midi.sendShortMsg(0x91, 0x0C, cueMasterLedValue);
+};
+
+// Cue mix button, toggles PFL / master split feature
+// We need a special function for this because we want to turn on the LED (but
+// we *don't* want to turn on the LED when the user clicks the headSplit button
+// in the GUI).
+DJCMIX.cueMix = function(_channel, _control, value, _status, _group) {
+ // This button acts as a toggle. Ignore the release.
+ if (value === 0) {
+ return;
+ }
+
+ // Toggle state.
+ script.toggleControl("[Master]", "headSplit");
+
+ // Set LED (will be overwritten when [Shift] is released)
+ const cueMixLedValue =
+ engine.getValue("[Master]", "headSplit") ? 0x7F : 0x00;
+ midi.sendShortMsg(0x92, 0x0C, cueMixLedValue);
+};
+
+DJCMIX.shiftButton = function(_channel, _control, value, _status, _group) {
+ if (value >= 0x40) {
+ // When Shift is held, light the LEDS to show the status of the alt
+ // functions of the cue buttons.
+ const cueMasterLedValue =
+ engine.getValue("[Master]", "headMix") > 0 ? 0x7F : 0x00;
+ midi.sendShortMsg(0x91, 0x0C, cueMasterLedValue);
+ const cueMixLedValue =
+ engine.getValue("[Master]", "headSplit") ? 0x7F : 0x00;
+ midi.sendShortMsg(0x92, 0x0C, cueMixLedValue);
+ } else {
+ // When Shift is released, go back to the normal LED values.
+ const cueChan1LedValue =
+ engine.getValue("[Channel1]", "pfl") ? 0x7F : 0x00;
+ midi.sendShortMsg(0x91, 0x0C, cueChan1LedValue);
+ const cueChan2LedValue =
+ engine.getValue("[Channel2]", "pfl") ? 0x7F : 0x00;
+ midi.sendShortMsg(0x92, 0x0C, cueChan2LedValue);
+ }
+};
+
+DJCMIX.shutdown = function() {
+ midi.sendShortMsg(0xB0, 0x7F, 0x00);
+};
From cd177fe09df8985b4d4476e545ca778c6f7990d7 Mon Sep 17 00:00:00 2001
From: Joerg
Date: Thu, 28 Dec 2023 20:59:06 +0100
Subject: [PATCH 5/8] Changed syntax to ES6 class structure
---
.../Hercules-DJControl-MIX-scripts.js | 405 +++++++++---------
1 file changed, 204 insertions(+), 201 deletions(-)
diff --git a/res/controllers/Hercules-DJControl-MIX-scripts.js b/res/controllers/Hercules-DJControl-MIX-scripts.js
index 9342cd9ec2f..0cfad87fcdb 100644
--- a/res/controllers/Hercules-DJControl-MIX-scripts.js
+++ b/res/controllers/Hercules-DJControl-MIX-scripts.js
@@ -1,222 +1,225 @@
-// eslint-disable-next-line no-var
-var DJCMIX = {};
-///////////////////////////////////////////////////////////////
-// USER OPTIONS //
-///////////////////////////////////////////////////////////////
-
-// How fast scratching is.
-DJCMIX.scratchScale = 1.0;
-
-// How much faster seeking (shift+scratch) is than scratching.
-DJCMIX.scratchShiftMultiplier = 4;
-
-// How fast bending is.
-DJCMIX.bendScale = 1.0;
-
-// DJControl_MIX_scripts.js
-//
-// ****************************************************************************
-// * Mixxx mapping script file for the Hercules DJControl MIX.
-// * Author: DJ Phatso and Kerrick Staley
-// * Version 1 (Jan 2023)
-// * Based on Hercules DJControl Starlight mapping released with Mixxx v2.3.0
-// * -Remapped LOOP and SAMPLER section according to DJControl MIX layout
-// * -Added Master Volume and Headphone Volume
-// * -Removed superfluous LED configuration (not present on DJControl MIX)
-// * Forum: https://mixxx.discourse.group/t/hercules-contrl-mix-mapping/26581/
-// * Wiki: https://mixxx.org/wiki/doku.php/
-
-
-DJCMIX.kScratchActionNone = 0;
-DJCMIX.kScratchActionScratch = 1;
-DJCMIX.kScratchActionSeek = 2;
-DJCMIX.kScratchActionBend = 3;
-
-
-DJCMIX.init = function() {
- DJCMIX.scratchButtonState = true;
- DJCMIX.scratchAction = {
- 1: DJCMIX.kScratchActionNone,
- 2: DJCMIX.kScratchActionNone
+class DJCMixClass {
+ constructor() {
+ ///////////////////////////////////////////////////////////////
+ // USER OPTIONS //
+ ///////////////////////////////////////////////////////////////
+
+ // How fast scratching is.
+ this.scratchScale = 1.0;
+
+ // How much faster seeking (shift+scratch) is than scratching.
+ this.scratchShiftMultiplier = 4;
+
+ // How fast bending is.
+ this.bendScale = 1.0;
+
+ // DJControl_MIX_scripts.js
+ //
+ // ****************************************************************************
+ // * Mixxx mapping script file for the Hercules DJControl MIX.
+ // * Author: DJ Phatso and Kerrick Staley
+ // * Version 1 (Jan 2023)
+ // * Based on Hercules DJControl Starlight mapping released with Mixxx v2.3.0
+ // * -Remapped LOOP and SAMPLER section according to DJControl MIX layout
+ // * -Added Master Volume and Headphone Volume
+ // * -Removed superfluous LED configuration (not present on DJControl MIX)
+ // * Forum: https://mixxx.discourse.group/t/hercules-contrl-mix-mapping/26581/
+ // * Wiki: https://mixxx.org/wiki/doku.php/
+
+
+ this.kScratchActionNone = 0;
+ this.kScratchActionScratch = 1;
+ this.kScratchActionSeek = 2;
+ this.kScratchActionBend = 3;
+ }
+
+ init() {
+ this.scratchButtonState = true;
+ this.scratchAction = {
+ 1: this.kScratchActionNone,
+ 2: this.kScratchActionNone
+ };
+
+ // Vinyl button LED On.
+ midi.sendShortMsg(0x91, 0x03, 0x7F);
+
+ // Set effects Levels - Dry/Wet
+ engine.setParameter("[EffectRack1_EffectUnit1_Effect1]", "meta", 0.6);
+ engine.setParameter("[EffectRack1_EffectUnit1_Effect2]", "meta", 0.6);
+ engine.setParameter("[EffectRack1_EffectUnit1_Effect3]", "meta", 0.6);
+ engine.setParameter("[EffectRack1_EffectUnit2_Effect1]", "meta", 0.6);
+ engine.setParameter("[EffectRack1_EffectUnit2_Effect2]", "meta", 0.6);
+ engine.setParameter("[EffectRack1_EffectUnit2_Effect3]", "meta", 0.6);
+ engine.setParameter("[EffectRack1_EffectUnit1]", "mix", 1);
+ engine.setParameter("[EffectRack1_EffectUnit2]", "mix", 1);
+
+ // Ask the controller to send all current knob/slider values over MIDI, which will update
+ // the corresponding GUI controls in MIXXX.
+ midi.sendShortMsg(0xB0, 0x7F, 0x7F);
};
- // Vinyl button LED On.
- midi.sendShortMsg(0x91, 0x03, 0x7F);
-
- // Set effects Levels - Dry/Wet
- engine.setParameter("[EffectRack1_EffectUnit1_Effect1]", "meta", 0.6);
- engine.setParameter("[EffectRack1_EffectUnit1_Effect2]", "meta", 0.6);
- engine.setParameter("[EffectRack1_EffectUnit1_Effect3]", "meta", 0.6);
- engine.setParameter("[EffectRack1_EffectUnit2_Effect1]", "meta", 0.6);
- engine.setParameter("[EffectRack1_EffectUnit2_Effect2]", "meta", 0.6);
- engine.setParameter("[EffectRack1_EffectUnit2_Effect3]", "meta", 0.6);
- engine.setParameter("[EffectRack1_EffectUnit1]", "mix", 1);
- engine.setParameter("[EffectRack1_EffectUnit2]", "mix", 1);
-
- // Ask the controller to send all current knob/slider values over MIDI, which will update
- // the corresponding GUI controls in MIXXX.
- midi.sendShortMsg(0xB0, 0x7F, 0x7F);
-};
-
-// The Vinyl button, used to enable or disable scratching on the jog wheels (The Vinyl button enables both deck).
-DJCMIX.vinylButton = function(_channel, _control, value, _status, _group) {
- if (value) {
- if (DJCMIX.scratchButtonState) {
- DJCMIX.scratchButtonState = false;
- midi.sendShortMsg(0x91, 0x03, 0x00);
+ // The Vinyl button, used to enable or disable scratching on the jog wheels (The Vinyl button enables both deck).
+ vinylButton(_channel, _control, value, _status, _group) {
+ if (value) {
+ if (this.scratchButtonState) {
+ this.scratchButtonState = false;
+ midi.sendShortMsg(0x91, 0x03, 0x00);
+
+ } else {
+ this.scratchButtonState = true;
+ midi.sendShortMsg(0x91, 0x03, 0x7F);
+ }
+ }
+ }
+
+ _scratchEnable(deck) {
+ const alpha = 1.0 / 8;
+ const beta = alpha / 32;
+ engine.scratchEnable(deck, 248, 33 + 1 / 3, alpha, beta);
+ }
+
+ _convertWheelRotation(value) {
+ // When you rotate the jogwheel, the controller always sends either 0x1
+ // (clockwise) or 0x7F (counter clockwise). 0x1 should map to 1, 0x7F
+ // should map to -1 (IOW it's 7-bit signed).
+ return value < 0x40 ? 1 : -1;
+ }
+
+ // The touch action on the jog wheel's top surface
+ wheelTouch(channel, _control, value, _status, _group) {
+ const deck = channel;
+ if (value > 0) {
+ // Touching the wheel.
+ if (engine.getValue("[Channel" + deck + "]", "play") !== 1 || this.scratchButtonState) {
+ this._scratchEnable(deck);
+ this.scratchAction[deck] = this.kScratchActionScratch;
+ } else {
+ this.scratchAction[deck] = this.kScratchActionBend;
+ }
+ } else {
+ // Released the wheel.
+ engine.scratchDisable(deck);
+ this.scratchAction[deck] = this.kScratchActionNone;
+ }
+ }
+ // The touch action on the jog wheel's top surface while holding shift
+ wheelTouchShift(channel, _control, value, _status, _group) {
+ const deck = channel - 3;
+ // We always enable scratching regardless of button state.
+ if (value > 0) {
+ this._scratchEnable(deck);
+ this.scratchAction[deck] = this.kScratchActionSeek;
} else {
- DJCMIX.scratchButtonState = true;
- midi.sendShortMsg(0x91, 0x03, 0x7F);
+ // Released the wheel.
+ engine.scratchDisable(deck);
+ this.scratchAction[deck] = this.kScratchActionNone;
}
}
-};
-
-DJCMIX._scratchEnable = function(deck) {
- const alpha = 1.0/8;
- const beta = alpha/32;
- engine.scratchEnable(deck, 248, 33 + 1/3, alpha, beta);
-};
-
-DJCMIX._convertWheelRotation = function(value) {
- // When you rotate the jogwheel, the controller always sends either 0x1
- // (clockwise) or 0x7F (counter clockwise). 0x1 should map to 1, 0x7F
- // should map to -1 (IOW it's 7-bit signed).
- return value < 0x40 ? 1 : -1;
-};
-
-// The touch action on the jog wheel's top surface
-DJCMIX.wheelTouch = function(channel, _control, value, _status, _group) {
- const deck = channel;
- if (value > 0) {
- // Touching the wheel.
- if (engine.getValue("[Channel" + deck + "]", "play") !== 1 || DJCMIX.scratchButtonState) {
- DJCMIX._scratchEnable(deck);
- DJCMIX.scratchAction[deck] = DJCMIX.kScratchActionScratch;
+
+ // Scratching on the jog wheel (rotating it while pressing the top surface)
+ _scratchWheelImpl(deck, value) {
+ const interval = this._convertWheelRotation(value);
+ const scratchAction = this.scratchAction[deck];
+
+ if (scratchAction === this.kScratchActionScratch) {
+ engine.scratchTick(deck, interval * this.scratchScale);
+ } else if (scratchAction === this.kScratchActionSeek) {
+ engine.scratchTick(deck,
+ interval
+ * this.scratchScale
+ * this.scratchShiftMultiplier);
} else {
- DJCMIX.scratchAction[deck] = DJCMIX.kScratchActionBend;
+ this._bendWheelImpl(deck, value);
}
- } else {
- // Released the wheel.
- engine.scratchDisable(deck);
- DJCMIX.scratchAction[deck] = DJCMIX.kScratchActionNone;
}
-};
-
-// The touch action on the jog wheel's top surface while holding shift
-DJCMIX.wheelTouchShift = function(channel, _control, value, _status, _group) {
- const deck = channel - 3;
- // We always enable scratching regardless of button state.
- if (value > 0) {
- DJCMIX._scratchEnable(deck);
- DJCMIX.scratchAction[deck] = DJCMIX.kScratchActionSeek;
- } else {
- // Released the wheel.
- engine.scratchDisable(deck);
- DJCMIX.scratchAction[deck] = DJCMIX.kScratchActionNone;
+
+ // Scratching on the jog wheel (rotating it while pressing the top surface)
+ scratchWheel(channel, _control, value, _status, _group) {
+ const deck = channel;
+ this._scratchWheelImpl(deck, value);
}
-};
-
-// Scratching on the jog wheel (rotating it while pressing the top surface)
-DJCMIX._scratchWheelImpl = function(deck, value) {
- const interval = DJCMIX._convertWheelRotation(value);
- const scratchAction = DJCMIX.scratchAction[deck];
-
- if (scratchAction === DJCMIX.kScratchActionScratch) {
- engine.scratchTick(deck, interval * DJCMIX.scratchScale);
- } else if (scratchAction === DJCMIX.kScratchActionSeek) {
- engine.scratchTick(deck,
- interval
- * DJCMIX.scratchScale
- * DJCMIX.scratchShiftMultiplier);
- } else {
- DJCMIX._bendWheelImpl(deck, value);
+
+ // Seeking on the jog wheel (rotating it while pressing the top surface and holding Shift)
+ scratchWheelShift(channel, _control, value, _status, _group) {
+ const deck = channel - 3;
+ this._scratchWheelImpl(deck, value);
}
-};
-
-// Scratching on the jog wheel (rotating it while pressing the top surface)
-DJCMIX.scratchWheel = function(channel, _control, value, _status, _group) {
- const deck = channel;
- DJCMIX._scratchWheelImpl(deck, value);
-};
-
-// Seeking on the jog wheel (rotating it while pressing the top surface and holding Shift)
-DJCMIX.scratchWheelShift = function(channel, _control, value, _status, _group) {
- const deck = channel - 3;
- DJCMIX._scratchWheelImpl(deck, value);
-};
-
-DJCMIX._bendWheelImpl = function(deck, value) {
- const interval = DJCMIX._convertWheelRotation(value);
- engine.setValue("[Channel" + deck + "]", "jog",
- interval * DJCMIX.bendScale);
-};
-
-// Bending on the jog wheel (rotating using the edge)
-DJCMIX.bendWheel = function(channel, _control, value, _status, _group) {
- const deck = channel;
- DJCMIX._bendWheelImpl(deck, value);
-};
-
-// Cue master button
-DJCMIX.cueMaster = function(_channel, _control, value, _status, _group) {
- // This button acts as a toggle. Ignore the release.
- if (value === 0) {
- return;
+
+ _bendWheelImpl(deck, value) {
+ const interval = this._convertWheelRotation(value);
+ engine.setValue("[Channel" + deck + "]", "jog",
+ interval * this.bendScale);
}
- let masterIsCued = engine.getValue("[Master]", "headMix") > 0;
- // Toggle state.
- masterIsCued = !masterIsCued;
-
- const headMixValue = masterIsCued ? 1 : -1;
- engine.setValue("[Master]", "headMix", headMixValue);
-
- // Set LED (will be overwritten when [Shift] is released)
- const cueMasterLedValue = masterIsCued ? 0x7F : 0x00;
- midi.sendShortMsg(0x91, 0x0C, cueMasterLedValue);
-};
-
-// Cue mix button, toggles PFL / master split feature
-// We need a special function for this because we want to turn on the LED (but
-// we *don't* want to turn on the LED when the user clicks the headSplit button
-// in the GUI).
-DJCMIX.cueMix = function(_channel, _control, value, _status, _group) {
- // This button acts as a toggle. Ignore the release.
- if (value === 0) {
- return;
+ // Bending on the jog wheel (rotating using the edge)
+ bendWheel(channel, _control, value, _status, _group) {
+ const deck = channel;
+ this._bendWheelImpl(deck, value);
}
- // Toggle state.
- script.toggleControl("[Master]", "headSplit");
-
- // Set LED (will be overwritten when [Shift] is released)
- const cueMixLedValue =
- engine.getValue("[Master]", "headSplit") ? 0x7F : 0x00;
- midi.sendShortMsg(0x92, 0x0C, cueMixLedValue);
-};
-
-DJCMIX.shiftButton = function(_channel, _control, value, _status, _group) {
- if (value >= 0x40) {
- // When Shift is held, light the LEDS to show the status of the alt
- // functions of the cue buttons.
- const cueMasterLedValue =
- engine.getValue("[Master]", "headMix") > 0 ? 0x7F : 0x00;
+ // Cue master button
+ cueMaster(_channel, _control, value, _status, _group) {
+ // This button acts as a toggle. Ignore the release.
+ if (value === 0) {
+ return;
+ }
+
+ let masterIsCued = engine.getValue("[Master]", "headMix") > 0;
+ // Toggle state.
+ masterIsCued = !masterIsCued;
+
+ const headMixValue = masterIsCued ? 1 : -1;
+ engine.setValue("[Master]", "headMix", headMixValue);
+
+ // Set LED (will be overwritten when [Shift] is released)
+ const cueMasterLedValue = masterIsCued ? 0x7F : 0x00;
midi.sendShortMsg(0x91, 0x0C, cueMasterLedValue);
+ }
+
+ // Cue mix button, toggles PFL / master split feature
+ // We need a special function for this because we want to turn on the LED (but
+ // we *don't* want to turn on the LED when the user clicks the headSplit button
+ // in the GUI).
+ cueMix(_channel, _control, value, _status, _group) {
+ // This button acts as a toggle. Ignore the release.
+ if (value === 0) {
+ return;
+ }
+
+ // Toggle state.
+ script.toggleControl("[Master]", "headSplit");
+
+ // Set LED (will be overwritten when [Shift] is released)
const cueMixLedValue =
engine.getValue("[Master]", "headSplit") ? 0x7F : 0x00;
midi.sendShortMsg(0x92, 0x0C, cueMixLedValue);
- } else {
- // When Shift is released, go back to the normal LED values.
- const cueChan1LedValue =
- engine.getValue("[Channel1]", "pfl") ? 0x7F : 0x00;
- midi.sendShortMsg(0x91, 0x0C, cueChan1LedValue);
- const cueChan2LedValue =
- engine.getValue("[Channel2]", "pfl") ? 0x7F : 0x00;
- midi.sendShortMsg(0x92, 0x0C, cueChan2LedValue);
}
-};
-DJCMIX.shutdown = function() {
- midi.sendShortMsg(0xB0, 0x7F, 0x00);
-};
+ shiftButton(_channel, _control, value, _status, _group) {
+ if (value >= 0x40) {
+ // When Shift is held, light the LEDS to show the status of the alt
+ // functions of the cue buttons.
+ const cueMasterLedValue =
+ engine.getValue("[Master]", "headMix") > 0 ? 0x7F : 0x00;
+ midi.sendShortMsg(0x91, 0x0C, cueMasterLedValue);
+ const cueMixLedValue =
+ engine.getValue("[Master]", "headSplit") ? 0x7F : 0x00;
+ midi.sendShortMsg(0x92, 0x0C, cueMixLedValue);
+ } else {
+ // When Shift is released, go back to the normal LED values.
+ const cueChan1LedValue =
+ engine.getValue("[Channel1]", "pfl") ? 0x7F : 0x00;
+ midi.sendShortMsg(0x91, 0x0C, cueChan1LedValue);
+ const cueChan2LedValue =
+ engine.getValue("[Channel2]", "pfl") ? 0x7F : 0x00;
+ midi.sendShortMsg(0x92, 0x0C, cueChan2LedValue);
+ }
+ }
+
+ shutdown() {
+ midi.sendShortMsg(0xB0, 0x7F, 0x00);
+ }
+}
+
+var DJCMIX = new DJCMixClass; // eslint-disable-line no-var, no-unused-vars
From bab28d7ecaeba65312738514aaf3be297ccbb110 Mon Sep 17 00:00:00 2001
From: DJ Phatso <48333945+DJPhatso@users.noreply.github.com>
Date: Wed, 3 Jan 2024 10:06:10 -0500
Subject: [PATCH 6/8] Update Hercules-DJControl-MIX-scripts.js
Made all suggested changes to script.
---
res/controllers/Hercules-DJControl-MIX-scripts.js | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/res/controllers/Hercules-DJControl-MIX-scripts.js b/res/controllers/Hercules-DJControl-MIX-scripts.js
index 0cfad87fcdb..5c53b7a644c 100644
--- a/res/controllers/Hercules-DJControl-MIX-scripts.js
+++ b/res/controllers/Hercules-DJControl-MIX-scripts.js
@@ -1,5 +1,3 @@
-class DJCMixClass {
- constructor() {
///////////////////////////////////////////////////////////////
// USER OPTIONS //
///////////////////////////////////////////////////////////////
@@ -13,19 +11,19 @@ class DJCMixClass {
// How fast bending is.
this.bendScale = 1.0;
- // DJControl_MIX_scripts.js
+ // Hercules-DJControl-MIX-scripts.js
//
// ****************************************************************************
// * Mixxx mapping script file for the Hercules DJControl MIX.
// * Author: DJ Phatso and Kerrick Staley
- // * Version 1 (Jan 2023)
// * Based on Hercules DJControl Starlight mapping released with Mixxx v2.3.0
// * -Remapped LOOP and SAMPLER section according to DJControl MIX layout
// * -Added Master Volume and Headphone Volume
// * -Removed superfluous LED configuration (not present on DJControl MIX)
// * Forum: https://mixxx.discourse.group/t/hercules-contrl-mix-mapping/26581/
- // * Wiki: https://mixxx.org/wiki/doku.php/
+class DJCMixClass {
+ constructor() {
this.kScratchActionNone = 0;
this.kScratchActionScratch = 1;
@@ -56,7 +54,7 @@ class DJCMixClass {
// Ask the controller to send all current knob/slider values over MIDI, which will update
// the corresponding GUI controls in MIXXX.
midi.sendShortMsg(0xB0, 0x7F, 0x7F);
- };
+ }
// The Vinyl button, used to enable or disable scratching on the jog wheels (The Vinyl button enables both deck).
vinylButton(_channel, _control, value, _status, _group) {
@@ -216,7 +214,7 @@ class DJCMixClass {
midi.sendShortMsg(0x92, 0x0C, cueChan2LedValue);
}
}
-
+ // All LED Turned off
shutdown() {
midi.sendShortMsg(0xB0, 0x7F, 0x00);
}
From 8e68d66e2bf8ac67686929d6abefe7dc3c90b412 Mon Sep 17 00:00:00 2001
From: DJ Phatso <48333945+DJPhatso@users.noreply.github.com>
Date: Wed, 3 Jan 2024 10:13:31 -0500
Subject: [PATCH 7/8] Update Hercules DJControl MIX.midi.xml
Made suggested changes to xml file
---
res/controllers/Hercules DJControl MIX.midi.xml | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/res/controllers/Hercules DJControl MIX.midi.xml b/res/controllers/Hercules DJControl MIX.midi.xml
index 7676716c43b..f4a0e34d3c7 100644
--- a/res/controllers/Hercules DJControl MIX.midi.xml
+++ b/res/controllers/Hercules DJControl MIX.midi.xml
@@ -3,7 +3,7 @@
Hercules DJControl MIX
DJ Phatso for Hercules Technical Support, contributions by Kerrick Staley
- MIDI Preset for Hercules DJControl MIX
+ MIDI Mapping for Hercules DJControl MIX
https://mixxx.discourse.group/t/hercules-contrl-mix-mapping/26581/
hercules_djcontrol_MIX
@@ -202,7 +202,7 @@
// Sync
[Channel1]
- sync_master
+ sync_leader
SHIFT + Sync: Sync Master
0x94
0x05
@@ -266,7 +266,7 @@
// Sync
[Channel2]
- sync_master
+ sync_leader
SHIFT + Sync: Sync Master
0x95
0x05
@@ -1104,7 +1104,7 @@