Skip to content

Commit

Permalink
Merge pull request #4524 from Holzhaus/controller-console-log
Browse files Browse the repository at this point in the history
Controllers: Use console.log instead of engine.log
  • Loading branch information
Swiftb0y committed Nov 16, 2021
2 parents 9c4210b + 6d3b4c5 commit 259b635
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
26 changes: 13 additions & 13 deletions res/controllers/Hercules-DJ-Console-4-Mx-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ Hercules4Mx.shutdown = function() {
//Set all leds to off
Hercules4Mx.allLedsOff = function() {
if (Hercules4Mx.debuglog) {
engine.log("Hercules4Mx.allLedsOff: switching leds off");
console.log("Hercules4Mx.allLedsOff: switching leds off");
}
// Switch off all LEDs
// +0x20 -> the other deck
Expand Down Expand Up @@ -471,7 +471,7 @@ Hercules4Mx.onEnableLed = function(value, group, control) {
//A change in the loop position or loop state has happened.
Hercules4Mx.onLoopStateChange = function(value, group, control) {
if (Hercules4Mx.debuglog) {
engine.log("Hercules4Mx.onLoopStateChange: value, group, control: " + value + ", " + group + ", " + control);
console.log("Hercules4Mx.onLoopStateChange: value, group, control: " + value + ", " + group + ", " + control);
}
var deck = script.deckFromGroup(group);
var messageto = (deck === 1 || deck === 2) ? Hercules4Mx.NOnC1 : Hercules4Mx.NOnC2;
Expand Down Expand Up @@ -1210,20 +1210,20 @@ Hercules4Mx.effectKnob = function(midichan, control, value, status, group) {
//This is used in conjunction with the keypad button mapping. It's the default "no-operation" action.
Hercules4Mx.FxActionNoOp = function(group, fxbutton, value, extraparam) {
if (Hercules4Mx.debuglog) {
engine.log("entering Hercules4Mx.FxActionNoOp");
console.log("entering Hercules4Mx.FxActionNoOp");
}
};
//This is used in conjunction with the keypad button mapping. A keypad button has been pushed
Hercules4Mx.buttonPush = function(group, fxbutton, value, extraparam) {
if (Hercules4Mx.debuglog) {
engine.log("entering Hercules4Mx.buttonPush");
console.log("entering Hercules4Mx.buttonPush");
}
engine.setValue(group, extraparam, value);
};
//This is used in conjunction with the keypad button mapping. A keypad button for an audio effect has been pushed
Hercules4Mx.FxSwitchDown = function(group, fxbutton, value, extraparam) {
if (Hercules4Mx.debuglog) {
engine.log("entering Hercules4Mx.FxSwitchDown");
console.log("entering Hercules4Mx.FxSwitchDown");
}
if (Hercules4Mx.editModeStatus.mode !== Hercules4Mx.editModes.disabled) {
Hercules4Mx.deactivateEditModeAction();
Expand All @@ -1234,7 +1234,7 @@ Hercules4Mx.FxSwitchDown = function(group, fxbutton, value, extraparam) {
//This is used in conjunction with the keypad button mapping. A keypad button for an audio effect has been released
Hercules4Mx.FxSwitchUp = function(group, fxbutton, value, extraparam) {
if (Hercules4Mx.debuglog) {
engine.log("entering Hercules4Mx.FxSwitchUp");
console.log("entering Hercules4Mx.FxSwitchUp");
}
if (Hercules4Mx.editModeStatus.used === false) {
var deck = script.deckFromGroup(group);
Expand All @@ -1246,7 +1246,7 @@ Hercules4Mx.FxSwitchUp = function(group, fxbutton, value, extraparam) {
//This is used in conjunction with the keypad button mapping. A keypad button for an audio effect has been released
Hercules4Mx.FxSamplerPush = function(group, fxbutton, value, extraparam) {
if (Hercules4Mx.debuglog) {
engine.log("entering Hercules4Mx.FxSamplerPush");
console.log("entering Hercules4Mx.FxSamplerPush");
}
var deck = script.deckFromGroup(group);
//Since the sampler does not depend on the deck, buttons on deck
Expand Down Expand Up @@ -1296,7 +1296,7 @@ Hercules4Mx.FxSamplerPush = function(group, fxbutton, value, extraparam) {
*/
Hercules4Mx.LoopEditPress = function(group, fxbutton, value, extraparam) {
if (Hercules4Mx.debuglog) {
engine.log("entering Hercules4Mx.LoopEditPress");
console.log("entering Hercules4Mx.LoopEditPress");
}
if (Hercules4Mx.editModeStatus.mode !== Hercules4Mx.editModes.disabled) {
Hercules4Mx.deactivateEditModeAction();
Expand All @@ -1306,7 +1306,7 @@ Hercules4Mx.LoopEditPress = function(group, fxbutton, value, extraparam) {
};
Hercules4Mx.LoopEditRelease = function(group, fxbutton, value, extraparam) {
if (Hercules4Mx.debuglog) {
engine.log("entering Hercules4Mx.LoopEditRelease");
console.log("entering Hercules4Mx.LoopEditRelease");
}
if (Hercules4Mx.editModeStatus.used === false) {
var deck = script.deckFromGroup(group);
Expand All @@ -1333,7 +1333,7 @@ Hercules4Mx.LoopEditRelease = function(group, fxbutton, value, extraparam) {
};
Hercules4Mx.LoopEditComplete = function(group, button) {
if (Hercules4Mx.debuglog) {
engine.log("Hercules4Mx.LoopEditComplete");
console.log("Hercules4Mx.LoopEditComplete");
}
switch (button) {
case 1:
Expand Down Expand Up @@ -1362,7 +1362,7 @@ Hercules4Mx.LoopEditComplete = function(group, button) {
};
Hercules4Mx.LoopButtonPush = function(group, fxbutton, value, extraparam) {
if (Hercules4Mx.debuglog) {
engine.log("Hercules4Mx.LoopButtonPush");
console.log("Hercules4Mx.LoopButtonPush");
}
var splitted = extraparam.split(";");
if (splitted[0] === "roll" && splitted.length === 2) {
Expand Down Expand Up @@ -1405,8 +1405,8 @@ Hercules4Mx.FXButton = function(midichan, control, value, status, groupInitial)
}
} else if (value) {
if (Hercules4Mx.debuglog === true) {
engine.log(JSON.stringify(mapping));
engine.log(JSON.stringify(Hercules4Mx.noActionButtonMap));
console.log(JSON.stringify(mapping));
console.log(JSON.stringify(Hercules4Mx.noActionButtonMap));
}
mapping.buttonPressAction(group, fxbutton, 1, mapping.extraParameter);
} else if (mapping.buttonReleaseAction !== null) {
Expand Down
10 changes: 7 additions & 3 deletions res/controllers/common-controller-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ String.prototype.toInt = function() {

// ----------------- Function overloads ---------------------

// Causes script print() calls to appear in the log file as well
var print = function(string) {
engine.log(string);
/**
* Prints a message to the terminal and the log file.
* @param {string} message - The log message.
* @deprecated Use console.log()/console.warn()/console.debug() instead.
*/
var print = function(message) {
console.log(message);
};

// eslint-disable-next-line no-unused-vars
Expand Down

0 comments on commit 259b635

Please sign in to comment.