summaryrefslogtreecommitdiffstats
path: root/res/controllers/Hercules-DJ-Console-4-Mx-scripts.js
diff options
context:
space:
mode:
authorjosepma <josepma@gmail.com>2015-12-21 14:42:09 +0100
committerjosepma <josepma@gmail.com>2015-12-21 14:42:09 +0100
commit53fc33d3bb14c59c3b9b7bb4ab222a16dcbfd7d5 (patch)
treec6c5771266d6cc04d2b9278429dbd6c088baac34 /res/controllers/Hercules-DJ-Console-4-Mx-scripts.js
parent7d39837f7cb1066da86fe29964123a3938d075ac (diff)
Updates to mapping
Diffstat (limited to 'res/controllers/Hercules-DJ-Console-4-Mx-scripts.js')
-rw-r--r--res/controllers/Hercules-DJ-Console-4-Mx-scripts.js283
1 files changed, 142 insertions, 141 deletions
diff --git a/res/controllers/Hercules-DJ-Console-4-Mx-scripts.js b/res/controllers/Hercules-DJ-Console-4-Mx-scripts.js
index 5760f5188c..48140ddbc9 100644
--- a/res/controllers/Hercules-DJ-Console-4-Mx-scripts.js
+++ b/res/controllers/Hercules-DJ-Console-4-Mx-scripts.js
@@ -6,17 +6,17 @@
// Author: josepma@gmail.com
//
// Version 2015-12-12:
-// Initial version. 4 decks, jog wheel and scratch, autodj, navigation and effects.
+// Initial version. 4 decks, jog wheel and scratch, autodj, navigation and effects.
// Version 2015-12-19:
-// Improvements from https://github.com/mixxxdj/mixxx/pull/810
-// Beat flashing can be configurd on pitch reset led, jog led, sync button or disabled completely.
-// Option to switch automatically to scratch crossfader curve on scratch mode.
-// Soft takeover for pitch, volume faders, eq knobs and gain.
-// Use the 14bit (8bit actually) range for the pitch slider if enabled from the configuration.
-// Changed stop button to be cue gotoandstop.
-// Removed midi channel configuration. It also required modifying the mapping, so it didn't really work.
-// Automatically setup some internal values, like 4 decks mode
-// Support speed sensor on jog wheel and Fx knob. They need to be moved really fast, so it's rarely useful.
+// Improvements from https://github.com/mixxxdj/mixxx/pull/810
+// Beat flashing can be configurd on pitch reset led, jog led, sync button or disabled completely.
+// Option to switch automatically to scratch crossfader curve on scratch mode.
+// Soft takeover for pitch, volume faders, eq knobs and gain.
+// Use the 14bit range automatically (8bit actually) for the pitch slider if the controller is configured to use it.
+// Changed stop button to be cue_gotoandstop.
+// Removed midi channel configuration. It also required modifying the mapping, so it didn't really work.
+// Automatically setup some internal values, like 4 decks mode
+// Support speed sensor on jog wheel and Fx knob. They need to be moved really fast, so it's rarely useful.
//
// Usage:
// ------
@@ -24,15 +24,16 @@
// http://mixxx.org/wiki/doku.php/hercules_dj_console_4-mx
//
// Variables on Hercules4Mx.userSettings can be modified by users to suit their preferences.
-//
-//
+/////////////////////////////////////////////////////////////////////
var Hercules4Mx = function() {};
+
+// The 4 possible values for the beatFlashLed option below.
Hercules4Mx.Leds = {
- "none" : 0,
- "syncLed" : 0x11,
- "pitchResetLed" : 0x15,
- "JogLed" : 0x1A
+ "none" : 0,
+ "syncLed" : 0x11,
+ "pitchResetLed" : 0x15,
+ "JogLed" : 0x1A
};
// --- Personal preferences configuration ---
Hercules4Mx.userSettings = {
@@ -40,29 +41,29 @@ Hercules4Mx.userSettings = {
'autoHeadMix': false,
// Enable automatically the headphone cue select (PFL) of the deck when a song is loaded. (Like in virtual-dj)
'autoHeadcueOnLoad': true,
- // Flashing at the rythm of the beat on the led. Use the Leds map above.
- // Note: if using sync button, then it will not show sync master state.
- 'beatFlashLed': Hercules4Mx.Leds.JogLed,
+ // Flashing at the rythm of the beat on the led. Use the Leds map above.
+ // Note: if using sync button, then the button will not show sync master state.
+ 'beatFlashLed': Hercules4Mx.Leds.JogLed,
// KeyRepeat speed for navigating up/down, in milliseconds. 125 is a good value. Lower values make it scroll faster.
'naviScrollSpeed': 125,
- // The controller has two modes to report the crossfader position. The default/beatmix curve, and the scratch curve.
- // The default curve reports the real position of the control. The scratch curve just crossfades on the edges.
- // Setting this setting to true, the curve will change to scratch curve when the scratch mode is on (scratch button).
- // Setting it to false will not change it, so it will use the setting configured in the DJHercules Tray-icon configuration.
- 'crossfaderScratchCurve' : false,
+ // The controller has two modes to report the crossfader position. The default/beatmix curve, and the scratch curve.
+ // The default curve reports the real position of the control. The scratch curve just crossfades on the edges.
+ // Setting this setting to true, the curve will change to scratch curve when the scratch mode is on (scratch button).
+ // Setting it to false will not change it, so it will use the setting configured in the DJHercules Tray-icon configuration.
+ 'crossfaderScratchCurve' : false,
// _Scratching_ Playback speed of the virtual vinyl that is being scratched. 45.00 and 33.33 are the common speeeds. (Lower number equals faster scratch)
'vinylSpeed': 45,
// _Scratching_ You should configure this setting to the same value than in the DJHercules tray icon configuration. (Normal means 1/1).
- // If crossfaderScratchCurve is true, or the setting is changed while Mixxx is active, this value will be detected automatically.
+ // If crossfaderScratchCurve is true, or the setting is changed while Mixxx is active, this value will be detected automatically.
'sensitivity': 1 / 1,
// _Scratching_ alpha value for the filter (start with 1/8 (0.125) and tune from there)
'alpha': 1 / 8,
// _Scratching_ beta value for the filter (start with alpha/32 and tune from there)
'beta': (1 / 8) / 32,
- // This controls the function of the deck C/deck D buttons (changes the setting in the tray-icon configuration, avanced tab)
- // Deck button mode: deckmode=0 2 Decks only, deckmode=1 2 Decks with deck switch button command, deckmode=2 4 decks.
- // Since Mixxx supports 4 decks and this mapping is configured for all four decks, the default value is 2.
- 'deckButtonMode': 2
+ // This controls the function of the deck C/deck D buttons (changes the setting in the tray-icon configuration, avanced tab)
+ // Deck button mode: deckmode=0 2 Decks only, deckmode=1 2 Decks with deck switch button command, deckmode=2 4 decks.
+ // Since Mixxx supports 4 decks and this mapping is configured for all four decks, the default value is 2.
+ 'deckButtonMode': 2
};
@@ -108,66 +109,66 @@ Hercules4Mx.CC = 0xB0;
// --- Initialization and shutdown ----
Hercules4Mx.init = function(id, debugging) {
Hercules4Mx.debuglog = debugging;
- //ensure all leds are in their default state
+ //ensure all leds are in their default state
Hercules4Mx.allLedsOff();
//Activate Files led.
midi.sendShortMsg(Hercules4Mx.NOnC1, 0x3E, 0x7F);
-
+
var i;
//Shift and deck buttons set to default
for (i = 0x72; i <= 0x77; i++) {
midi.sendShortMsg(Hercules4Mx.CC, i, 0x00);
}
- // Deck button mode
- midi.sendShortMsg(Hercules4Mx.CC, 0x78, Hercules4Mx.userSettings.deckButtonMode);
- // If the crossfader on scratch setting is on, set the value to normal curve by default.
- if (Hercules4Mx.userSettings.crossfaderScratchCurve) {
- midi.sendShortMsg(Hercules4Mx.CC, 0x7E, 0x00);
- }
+ // Deck button mode
+ midi.sendShortMsg(Hercules4Mx.CC, 0x78, Hercules4Mx.userSettings.deckButtonMode);
+ // If the crossfader on scratch setting is on, set the value to normal curve by default.
+ if (Hercules4Mx.userSettings.crossfaderScratchCurve) {
+ midi.sendShortMsg(Hercules4Mx.CC, 0x7E, 0x00);
+ }
// Tell the controller to report all current values to Mixxx (update_all_controls message)
- // Concretely it reports crossfader, master volume, master headmix, and EQ knobs, gain, pitch slider and vol fader of each channel.
+ // Concretely it reports crossfader, master volume, master headmix, and EQ knobs, gain, pitch slider and vol fader of each channel.
midi.sendShortMsg(Hercules4Mx.CC, 0x7F, 0x7F);
- //---Other possible actions:
- // jog wheel movement sensitivity divisor (i.e. 1/x).
- // midi.sendShortMsg(Hercules4Mx.CC, 0x79, sens); sens = 0 most sensitive, 0x7F least sensitive. 0x1 normal, 0x2 1/2, 0x4 1/4, and so on.
- //
- // lock jog wheel movement: 0x7A to 0x7D for each deck.
- // midi.sendShortMsg(Hercules4Mx.CC, 0x7A, enable); enable = 0 not locked, enable = 0x7F locked
+ //---Other possible actions:
+ // jog wheel movement sensitivity divisor (i.e. 1/x).
+ // midi.sendShortMsg(Hercules4Mx.CC, 0x79, sens); sens = 0 most sensitive, 0x7F least sensitive. 0x1 normal, 0x2 1/2, 0x4 1/4, and so on.
+ //
+ // ignore jog wheel movement: (codes from 0x7A to 0x7D, one for each deck).
+ // midi.sendShortMsg(Hercules4Mx.CC, 0x7A, enable); enable = 0 obey movement, enable = 0x7F ignore movement
// Connect several signals to javascript events, like song load, pre-fader-listen, looks or effects
- for (i = 1; i <= 4; i++) {
- engine.connectControl("[Channel" + i + "]", "pfl", "Hercules4Mx.onPreFaderListen");
- engine.connectControl("[Channel" + i + "]", "loop_enabled", "Hercules4Mx.onLoopStateChange");
- engine.connectControl("[Channel" + i + "]", "loop_start_position", "Hercules4Mx.onLoopStateChange");
- engine.connectControl("[Channel" + i + "]", "loop_end_position", "Hercules4Mx.onLoopStateChange");
-// TODO: control when they are enabled, so that FX knob can move the effect unit knob.
-// engine.connectControl("[EffectRack1_EffectUnit1]", "group_[Channel" + i + "]_enable", "Hercules4Mx.onEffectStateChange");
-// engine.connectControl("[EffectRack1_EffectUnit2]", "group_[Channel" + i + "]_enable", "Hercules4Mx.onEffectStateChange");
- }
+ for (i = 1; i <= 4; i++) {
+ engine.connectControl("[Channel" + i + "]", "pfl", "Hercules4Mx.onPreFaderListen");
+ engine.connectControl("[Channel" + i + "]", "loop_enabled", "Hercules4Mx.onLoopStateChange");
+ engine.connectControl("[Channel" + i + "]", "loop_start_position", "Hercules4Mx.onLoopStateChange");
+ engine.connectControl("[Channel" + i + "]", "loop_end_position", "Hercules4Mx.onLoopStateChange");
+// TODO: control when they are enabled, so that FX knob can move the effect unit knob.
+// engine.connectControl("[EffectRack1_EffectUnit1]", "group_[Channel" + i + "]_enable", "Hercules4Mx.onEffectStateChange");
+// engine.connectControl("[EffectRack1_EffectUnit2]", "group_[Channel" + i + "]_enable", "Hercules4Mx.onEffectStateChange");
+ }
if (Hercules4Mx.userSettings.autoHeadcueOnLoad) {
for (i = 1; i <= 4; i++) {
engine.connectControl("[Channel" + i + "]", "LoadSelectedTrack", "Hercules4Mx.onSongLoaded");
}
}
- if (Hercules4Mx.userSettings.beatFlashLed !== Hercules4Mx.Leds.syncLed ){
- //Set sync master led indicator
+ if (Hercules4Mx.userSettings.beatFlashLed !== Hercules4Mx.Leds.syncLed ){
+ //Set sync master led indicator
for (i = 1; i <= 4; i++) {
- engine.connectControl("[Channel" + i + "]", "sync_enabled", "Hercules4Mx.onSyncLed");
+ engine.connectControl("[Channel" + i + "]", "sync_enabled", "Hercules4Mx.onSyncLed");
}
- }
- if (Hercules4Mx.userSettings.beatFlashLed !== Hercules4Mx.Leds.none) {
- //Setup beat flashing led
+ }
+ if (Hercules4Mx.userSettings.beatFlashLed !== Hercules4Mx.Leds.none) {
+ //Setup beat flashing led
for (i = 1; i <= 4; i++) {
engine.connectControl("[Channel" + i + "]", "beat_active", "Hercules4Mx.onBeatFlash");
- }
- }
-
- // Activate soft takeover for the rate sliders
- for (i = 1; i <= 4; i++) {
- engine.softTakeover("[Channel" + i + "]","rate",true);
- engine.softTakeover("[Channel" + i + "]","rate",true);
- }
+ }
+ }
+
+ // Activate soft takeover for the rate sliders. The other sliders and knobs have softtakeover set in the xml mapping.
+ for (i = 1; i <= 4; i++) {
+ engine.softTakeover("[Channel" + i + "]","rate",true);
+ engine.softTakeover("[Channel" + i + "]","rate",true);
+ }
};
Hercules4Mx.shutdown = function() {
if (Hercules4Mx.navigationStatus.timeoutId !== null) {
@@ -176,11 +177,11 @@ Hercules4Mx.shutdown = function() {
if (Hercules4Mx.autoDJfadingId !== null) {
engine.stopTimer(Hercules4Mx.autoDJfadingId);
}
- // If the crossfader on scratch setting is on, set the value to normal curve on exit.
- if (Hercules4Mx.userSettings.crossfaderScratchCurve) {
- midi.sendShortMsg(Hercules4Mx.CC, 0x7E, 0x00);
- }
- //Cleanup leds before exiting.
+ // If the crossfader on scratch setting is on, set the value to normal curve on exit.
+ if (Hercules4Mx.userSettings.crossfaderScratchCurve) {
+ midi.sendShortMsg(Hercules4Mx.CC, 0x7E, 0x00);
+ }
+ //Cleanup leds before exiting.
Hercules4Mx.allLedsOff();
};
@@ -188,7 +189,7 @@ Hercules4Mx.shutdown = function() {
Hercules4Mx.allLedsOff = function() {
engine.log("Hercules4Mx.allLedsOff: switching leds off");
// Switch off all LEDs
- // +0x20 -> the other deck
+ // +0x20 -> the other deck
// +0x40 -> blinking.
var i;
for (i = 0x3C; i <= 0x3F; i++) { //auto, scratch, files, folders
@@ -200,16 +201,22 @@ Hercules4Mx.allLedsOff = function() {
midi.sendShortMsg(Hercules4Mx.NOnC2, i, 0x00);
midi.sendShortMsg(Hercules4Mx.NOnC1, i + 0x20, 0x00);
midi.sendShortMsg(Hercules4Mx.NOnC2, i + 0x20, 0x00);
- midi.sendShortMsg(Hercules4Mx.NOnC1, i + 0x40, 0x00);
- midi.sendShortMsg(Hercules4Mx.NOnC2, i + 0x40, 0x00);
- midi.sendShortMsg(Hercules4Mx.NOnC1, i + 0x60, 0x00);
- midi.sendShortMsg(Hercules4Mx.NOnC2, i + 0x60, 0x00);
}
for (i = 0x15; i <= 0x1A; i++) { //pitch led, source, kill,jog touch
midi.sendShortMsg(Hercules4Mx.NOnC1, i, 0x00);
midi.sendShortMsg(Hercules4Mx.NOnC2, i, 0x00);
midi.sendShortMsg(Hercules4Mx.NOnC1, i + 0x20, 0x00);
midi.sendShortMsg(Hercules4Mx.NOnC2, i + 0x20, 0x00);
+ }
+ // I've put these on a separate loop so that there are more chances for decks A/B leds to light off when shutdown,
+ // since there is a strange problem where not all messages are delivered.
+ for (i = 0x1; i <= 0x11; i++) { // Fx, cue, play, cuesel,stop, sync
+ midi.sendShortMsg(Hercules4Mx.NOnC1, i + 0x40, 0x00);
+ midi.sendShortMsg(Hercules4Mx.NOnC2, i + 0x40, 0x00);
+ midi.sendShortMsg(Hercules4Mx.NOnC1, i + 0x60, 0x00);
+ midi.sendShortMsg(Hercules4Mx.NOnC2, i + 0x60, 0x00);
+ }
+ for (i = 0x15; i <= 0x1A; i++) { //pitch led, source, kill,jog touch
midi.sendShortMsg(Hercules4Mx.NOnC1, i + 0x40, 0x00);
midi.sendShortMsg(Hercules4Mx.NOnC2, i + 0x40, 0x00);
midi.sendShortMsg(Hercules4Mx.NOnC1, i + 0x60, 0x00);
@@ -222,7 +229,7 @@ Hercules4Mx.allLedsOff = function() {
// The jog wheel sensitivity setting has changed. This is reported in two scenarios:
// when the setting is changed in the tray icon, and when the crossfader curve is changed to beatmix.
Hercules4Mx.onSensitivityChange = function(value, group, control) {
- Hercules4Mx.userSettings.sensitivity = 1/value;
+ Hercules4Mx.userSettings.sensitivity = 1/value;
}
//Action to do when a song is loaded in a deck. virtualDJ automatically enables the headphone cue (PFL)
@@ -269,7 +276,7 @@ Hercules4Mx.onLoopStateChange = function(value, group, control) {
// Controls the action to do when the headphone cue (pre-fader-listen) buttons are pressed.
Hercules4Mx.onPreFaderListen = function(value, group, control) {
if (Hercules4Mx.userSettings.autoHeadMix) {
- // If automatic head mix to master is enabled, check what to do.
+ // If automatic head mix to master is enabled, check what to do.
var pfl1 = engine.getParameter("[Channel1]", "pfl");
var pfl2 = engine.getParameter("[Channel2]", "pfl");
var pfl3 = engine.getParameter("[Channel3]", "pfl");
@@ -314,26 +321,26 @@ Hercules4Mx.onAutoDJFadeOff = function() {
//Beat flashing changed state
Hercules4Mx.onBeatFlash = function(value, group, control) {
- var deck = script.deckFromGroup(group);
- var val = (value) ? 0x7F : 0x00;
- var led = Hercules4Mx.userSettings.beatFlashLed;
- switch(deck){
- case 1: midi.sendShortMsg(Hercules4Mx.NOnC1, led, val); break;
- case 2: midi.sendShortMsg(Hercules4Mx.NOnC1, led+0x20, val); break;
- case 3: midi.sendShortMsg(Hercules4Mx.NOnC2, led, val); break;
- case 4: midi.sendShortMsg(Hercules4Mx.NOnC2, led+0x20, val); break;
- }
+ var deck = script.deckFromGroup(group);
+ var val = (value) ? 0x7F : 0x00;
+ var led = Hercules4Mx.userSettings.beatFlashLed;
+ switch(deck){
+ case 1: midi.sendShortMsg(Hercules4Mx.NOnC1, led, val); break;
+ case 2: midi.sendShortMsg(Hercules4Mx.NOnC1, led+0x20, val); break;
+ case 3: midi.sendShortMsg(Hercules4Mx.NOnC2, led, val); break;
+ case 4: midi.sendShortMsg(Hercules4Mx.NOnC2, led+0x20, val); break;
+ }
};
// Deck's Sync led changed state
Hercules4Mx.onSyncLed = function(value, group, control) {
- var deck = script.deckFromGroup(group);
- var val = (value) ? 0x7F : 0x00;
- switch(deck){
- case 1: midi.sendShortMsg(Hercules4Mx.NOnC1, 0x11, val); break;
- case 2: midi.sendShortMsg(Hercules4Mx.NOnC1, 0x31, val); break;
- case 3: midi.sendShortMsg(Hercules4Mx.NOnC2, 0x11, val); break;
- case 4: midi.sendShortMsg(Hercules4Mx.NOnC2, 0x31, val); break;
- }
+ var deck = script.deckFromGroup(group);
+ var val = (value) ? 0x7F : 0x00;
+ switch(deck){
+ case 1: midi.sendShortMsg(Hercules4Mx.NOnC1, 0x11, val); break;
+ case 2: midi.sendShortMsg(Hercules4Mx.NOnC1, 0x31, val); break;
+ case 3: midi.sendShortMsg(Hercules4Mx.NOnC2, 0x11, val); break;
+ case 4: midi.sendShortMsg(Hercules4Mx.NOnC2, 0x31, val); break;
+ }
};
///////////////////////////////////////////////////////////////////
@@ -375,7 +382,7 @@ Hercules4Mx.navigation = function(midichan, control, value, status, group) {
if (control === 0x3E) {
//FILES
if (Hercules4Mx.navigationStatus.sidebar === false &&
- engine.getParameter("[AutoDJ]", "enabled") === 1) {
+ engine.getParameter("[AutoDJ]", "enabled") === 1) {
// if autoDJ enabled and we are already at "files", skip next file
engine.setParameter("[AutoDJ]", "skip_next", 1);
} else {
@@ -404,7 +411,7 @@ Hercules4Mx.navigation = function(midichan, control, value, status, group) {
Hercules4Mx.doNavigate();
}
if (Hercules4Mx.navigationStatus.enabled &&
- Hercules4Mx.navigationStatus.timeoutId === null) {
+ Hercules4Mx.navigationStatus.timeoutId === null) {
//Enable key-repeat mode. Cursor will continue moving until button is released.
Hercules4Mx.navigationStatus.timeoutId = engine.beginTimer(Hercules4Mx.userSettings.naviScrollSpeed, Hercules4Mx.doNavigate);
}
@@ -454,8 +461,8 @@ Hercules4Mx.stateEffectShift = function(midichan, control, value, status, group)
//The effect knob granularity is very coarse, so we compensate it here so that it behaves like an analog one.
Hercules4Mx.effectKnob = function(midichan, control, value, status, group) {
- //It has a speed sensor, but you have to move it really fast for it to send something different.
- var direction = (value < 0x40) ? value : value-0x80;
+ //It has a speed sensor, but you have to move it really fast for it to send something different.
+ var direction = (value < 0x40) ? value : value-0x80;
var step = 1 / 20;
if (Hercules4Mx.shiftPressed) {
//If pressing shift, let's move it slowly.
@@ -467,10 +474,10 @@ Hercules4Mx.effectKnob = function(midichan, control, value, status, group) {
};
// Any of the FX buttons has been pressed
-// There are 6 physical buttons present, but the controller has a "shift" button
-// that it uses to sends 12 different messages, depending if it is shifted or not.
-// Since this is a button and it sends a different message to indicate button
-// pressure and button state, I've been able to setup up to 24 different actions.
+// There are 6 physical buttons present per deck, and also a "shift" button used by the controller
+// itself to switch between messages 1 to 6 and messages 7 to 12, depending if it is enabled or not.
+// Since the shift button also sends a message when it is pressed and when it is released,
+// I've been able to setup up to 24 different actions per deck.
// I call these additional 12 messages the "shift-pressed" mode.
Hercules4Mx.FXButton = function(midichan, control, value, status, group) {
var deck = script.deckFromGroup(group);
@@ -479,12 +486,12 @@ Hercules4Mx.FXButton = function(midichan, control, value, status, group) {
Hercules4Mx.shiftUsed = true;
}
switch (control) {
- // 1 to 6 and 0x21 to 0x26 are the 6 left deck and right deck buttons respectively, non shifted.
+ // 1 to 6 and 0x21 to 0x26 are the 6 left deck and right deck buttons respectively, with shift disabled.
// Loop buttons
case 0x01:
case 0x21: // K1, beatloop 1/ Loop in
if (value) {
- //Loop in in "shift-pressed" mode, beatloop of 1 beat otherwise
+ //beatloop 0.125 in "shift-pressed" mode, beatloop of 0.5 beat otherwise
if (Hercules4Mx.shiftPressed) {
engine.setValue(group, "beatloop_0.125_toggle", 1);
} else {
@@ -495,7 +502,7 @@ Hercules4Mx.FXButton = function(midichan, control, value, status, group) {
case 0x02:
case 0x22: // K2, beatloop 2/ Loop out
if (value) {
- //Loop out in "shift-pressed" mode, beatloop of 2 beat otherwise
+ //beatlook 0.25 in "shift-pressed" mode, beatloop of 1 beat otherwise
if (Hercules4Mx.shiftPressed) {
engine.setValue(group, "beatloop_0.25_toggle", 1);
} else {
@@ -529,12 +536,10 @@ Hercules4Mx.FXButton = function(midichan, control, value, status, group) {
case 0x05:
case 0x25: // K5, reverse play
engine.setValue(group, "reverse", (value) ? 1 : 0);
- engine.setValue(group, "reverse", (value) ? 1 : 0);
break;
case 0x06:
case 0x26: // K6, reverse roll play
engine.setValue(group, "reverseroll", (value) ? 1 : 0);
- engine.setValue(group, "reverse", (value) ? 1 : 0);
break;
// 7 to 0xC and 0x27 to 0x3C are the 6 left deck and right deck buttons respectively, with shift enabled.
@@ -546,8 +551,8 @@ Hercules4Mx.FXButton = function(midichan, control, value, status, group) {
engine.setValue(group, "hotcue_1_clear", 1);
}
} else {
- engine.setValue(group, "hotcue_1_activate", (value) ? 1 : 0);
- }
+ engine.setValue(group, "hotcue_1_activate", (value) ? 1 : 0);
+ }
break;
case 0x08:
case 0x28: // K8 Hotcue 2 activate/ clear
@@ -556,8 +561,8 @@ Hercules4Mx.FXButton = function(midichan, control, value, status, group) {
engine.setValue(group, "hotcue_2_clear", 1);
}
} else {
- engine.setValue(group, "hotcue_2_activate", (value) ? 1 : 0);
- }
+ engine.setValue(group, "hotcue_2_activate", (value) ? 1 : 0);
+ }
break;
case 0x09:
case 0x29: // K9 Hotcue 3 activate/ clear
@@ -566,8 +571,8 @@ Hercules4Mx.FXButton = function(midichan, control, value, status, group) {
engine.setValue(group, "hotcue_3_clear", 1);
}
} else {
- engine.setValue(group, "hotcue_3_activate", (value) ? 1 : 0);
- }
+ engine.setValue(group, "hotcue_3_activate", (value) ? 1 : 0);
+ }
break;
case 0x0A:
case 0x2A: // K10 Hotcue 4 activate/ clear
@@ -576,33 +581,29 @@ Hercules4Mx.FXButton = function(midichan, control, value, status, group) {
engine.setValue(group, "hotcue_4_clear", 1);
}
} else {
- engine.setValue(group, "hotcue_4_activate", (value) ? 1 : 0);
- }
+ engine.setValue(group, "hotcue_4_activate", (value) ? 1 : 0);
+ }
break;
//Effects
case 0x0B:
case 0x2B: // K11. Effect Unit 1
- {
if (value) {
engine.setParameter("[EffectRack1_EffectUnit1]", "group_[Channel" + deck + "]_enable", !engine.getParameter("[EffectRack1_EffectUnit1]", "group_[Channel" + deck + "]_enable"));
}
- }
break;
case 0x0C:
case 0x2C: // K12. Effect Unit 2
- {
if (value) {
engine.setParameter("[EffectRack1_EffectUnit2]", "group_[Channel" + deck + "]_enable", !engine.getParameter("[EffectRack1_EffectUnit2]", "group_[Channel" + deck + "]_enable"));
}
- }
break;
}
};
//Jog wheel moved without pressure (for seeking, speeding or slowing down, or navigating)
Hercules4Mx.jogWheel = function(midichan, control, value, status, group) {
- //It has a speed sensor, but you have to move it really fast for it to send something different.
- var direction = (value < 0x40) ? value : value-0x80;
+ //It has a speed sensor, but you have to move it really fast for it to send something different.
+ var direction = (value < 0x40) ? value : value-0x80;
if (Hercules4Mx.navigationStatus.enabled) {
if (Hercules4Mx.navigationStatus.timeoutId !== null) {
//Stop key-repeat mode. From now on, obey only jog movement until button is released.
@@ -623,15 +624,15 @@ Hercules4Mx.scratchButton = function(midichan, control, value, status, group) {
if (Hercules4Mx.scratchEnabled ) {
Hercules4Mx.scratchEnabled = false;
midi.sendShortMsg(Hercules4Mx.NOnC1, 0x7D, 0x00);
- if (Hercules4Mx.userSettings.crossfaderScratchCurve) {
- midi.sendShortMsg(Hercules4Mx.CC, 0x7E, 0x00);
- }
+ if (Hercules4Mx.userSettings.crossfaderScratchCurve) {
+ midi.sendShortMsg(Hercules4Mx.CC, 0x7E, 0x00);
+ }
} else {
Hercules4Mx.scratchEnabled = true;
midi.sendShortMsg(Hercules4Mx.NOnC1, 0x7D, 0x7F);
- if (Hercules4Mx.userSettings.crossfaderScratchCurve) {
- midi.sendShortMsg(Hercules4Mx.CC, 0x7E, 0x7F);
- }
+ if (Hercules4Mx.userSettings.crossfaderScratchCurve) {
+ midi.sendShortMsg(Hercules4Mx.CC, 0x7E, 0x7F);
+ }
}
}
};
@@ -656,7 +657,7 @@ Hercules4Mx.scratchWheel = function(midichan, control, value, status, group) {
//If navigating, or not in scratch mode, do jogWheel
Hercules4Mx.jogWheel(midichan, control, value, status, group);
} else {
- //It has a speed sensor, but you have to move it really fast for it to send something different.
+ //It has a speed sensor, but you have to move it really fast for it to send something different.
var direction = (value < 0x40) ? value : value-0x80;
engine.scratchTick(script.deckFromGroup(group), direction);
}
@@ -664,18 +665,18 @@ Hercules4Mx.scratchWheel = function(midichan, control, value, status, group) {
// Pitch slider rate change, MSB (Most significant bits in 14bit mode, or directly the value in 7bit)
Hercules4Mx.rateMsb = function(midichan, control, value, status, group) {
- if (Hercules4Mx.pitch14bitMode) {
- var deck = script.deckFromGroup(group);
- Hercules4Mx.pitchMsbValue[deck-1]=value;
- }
- else {
- engine.setParameter(group, "rate", value/0x7F);
- }
+ if (Hercules4Mx.pitch14bitMode) {
+ var deck = script.deckFromGroup(group);
+ Hercules4Mx.pitchMsbValue[deck-1]=value*0x80;
+ }
+ else {
+ engine.setParameter(group, "rate", value/0x7F);
+ }
};
// Pitch slider rate change, LSB (Least significant bits in 14bit mode, not called in 7bit)
Hercules4Mx.rateLsb = function(midichan, control, value, status, group) {
- var deck = script.deckFromGroup(group);
- var msbval = Hercules4Mx.pitchMsbValue[deck-1]*0x80;
- Hercules4Mx.pitch14bitMode = true;
- engine.setParameter(group, "rate", (msbval+value)/0x3FFF);
+ var deck = script.deckFromGroup(group);
+ var msbval = Hercules4Mx.pitchMsbValue[deck-1];
+ Hercules4Mx.pitch14bitMode = true;
+ engine.setParameter(group, "rate", (msbval+value)/0x3FFF);
};