Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
b36c378
Changed to ES2015 classes, const functions and used JSDoc deprecate s…
JoergAtGithub Jun 4, 2023
cedcda9
Merge remote-tracking branch 'upstream/2.4' into ConvertEmptyFunction…
JoergAtGithub Jun 4, 2023
610d4ce
Merge remote-tracking branch 'upstream/main' into ConvertEmptyFunctio…
JoergAtGithub May 8, 2024
4b2420d
Fixed qt.qml.compiler:warning warning 'Variable "stringifyObject"/"ar…
JoergAtGithub May 8, 2024
412c95f
Made regular expressions proper constants
JoergAtGithub May 8, 2024
977b3a6
Changed "script" class to less verbose object syntax
JoergAtGithub May 24, 2024
1188c8f
Remove redefinition of script.crossfaderCurve
JoergAtGithub May 25, 2024
e6ddf1f
Moved object definitions section (Controller, Deck, Control & Button)…
JoergAtGithub May 28, 2024
91d41c1
Call the constructor of bpmClass, instead of just aliasing it
JoergAtGithub May 29, 2024
dfc0f2e
Freeze object "script"
JoergAtGithub May 29, 2024
00a5b43
Merge remote-tracking branch 'upstream/2.5' into ConvertEmptyFunction…
JoergAtGithub May 30, 2024
8b57df3
Use var instead of const for script to make script.deepmerge working
JoergAtGithub Jul 16, 2024
acb1d93
Changed script's method definitions to ES6 methods
christophehenry Jul 16, 2024
8153113
Refactored arrayContains
JoergAtGithub Jul 17, 2024
ca59e06
Use default values and further optimization
JoergAtGithub Jul 17, 2024
fcff02a
Optimized String.prototype.toInt
JoergAtGithub Jul 17, 2024
45feddc
Fix tslint warnings
JoergAtGithub Jul 18, 2024
dbe9a26
Mark script.deepMerge as deprecated
JoergAtGithub Jul 18, 2024
0b22ff0
JSDoc
JoergAtGithub Jul 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions res/controllers/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@
"colorCodeToObject": "readonly",
"colorCodeFromObject": "readonly",
"script": "readonly",
"bpm": "readonly",
"ButtonState": "readonly",
"LedState": "readonly",
"Controller": "readonly",
"Button": "readonly",
"Control": "readonly",
"Deck": "readonly"
"bpm": "readonly"
}
}
3 changes: 2 additions & 1 deletion res/controllers/American-Audio-RADIUS-2000-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
* The Mapping for the Jog Wheel and Scratch function is great.
**/

RADIUS2000 = new Controller();
// eslint-disable-next-line no-var
var RADIUS2000 = {};

RADIUS2000.currentDeck = function (group) {
if (group == "[Channel1]")
Expand Down
51 changes: 51 additions & 0 deletions res/controllers/American-Audio-VMS2-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,57 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/


// ----------------- Object definitions --------------------------

var ButtonState = {"released": 0x00, "pressed": 0x7F};

var LedState = {"off": 0x00, "on": 0x7F};

// Controller

var Controller = function() {
this.group = "[Master]";
this.Buttons = [];
};

Controller.prototype.addButton = function(buttonName, button, eventHandler) {
if (eventHandler) {
/* eslint @typescript-eslint/no-this-alias: "off" */
const executionEnvironment = this;
const handler = function(value) {
button.state = value;
executionEnvironment[eventHandler](value);
};
button.handler = handler;
}
this.Buttons[buttonName] = button;
};

// Button

var Button = function(controlId) {
this.controlId = controlId;
this.state = ButtonState.released;
};
Button.prototype.handleEvent = function(value) {
this.handler(value);
};

// Deck

var Deck = function(deckNumber, group) {
this.deckNumber = deckNumber;
this.group = group;
this.Buttons = [];
};

Deck.prototype.addButton = Controller.prototype.addButton;

// ----------------- END Object definitions ----------------------


VMS2 = new Controller();

VMS2.RateRanges = [0.08, 0.10, 0.30, 1.00];
Expand Down
50 changes: 50 additions & 0 deletions res/controllers/American-Audio-VMS4-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,56 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/

// ----------------- Object definitions --------------------------



var ButtonState = {"released": 0x00, "pressed": 0x7F};

var LedState = {"off": 0x00, "on": 0x7F};

// Controller

var Controller = function() {
this.group = "[Master]";
this.Buttons = [];
};

Controller.prototype.addButton = function(buttonName, button, eventHandler) {
if (eventHandler) {
/* eslint @typescript-eslint/no-this-alias: "off" */
const executionEnvironment = this;
const handler = function(value) {
button.state = value;
executionEnvironment[eventHandler](value);
};
button.handler = handler;
}
this.Buttons[buttonName] = button;
};

// Button

var Button = function(controlId) {
this.controlId = controlId;
this.state = ButtonState.released;
};
Button.prototype.handleEvent = function(value) {
this.handler(value);
};

// Deck

var Deck = function(deckNumber, group) {
this.deckNumber = deckNumber;
this.group = group;
this.Buttons = [];
};
Deck.prototype.addButton = Controller.prototype.addButton;

// ----------------- END Object definitions ----------------------

VMS4 = new Controller();

VMS4.RateRanges = [0.08, 0.10, 0.30, 1.00];
Expand Down
3 changes: 2 additions & 1 deletion res/controllers/Hercules-DJ-Console-Mk1-hid-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
/* Author: zestoi with changes by ewanuno */
/****************************************************************/

HerculesMk1Hid = new Controller();
// eslint-disable-next-line no-var
var HerculesMk1Hid = {};
HerculesMk1Hid.controls = [];
HerculesMk1Hid.leds = [];
HerculesMk1Hid.cache_in = [];
Expand Down
3 changes: 2 additions & 1 deletion res/controllers/Hercules-DJ-Console-Mk2-hid-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
/* Author: zestoi */
/****************************************************************/

HerculesMk2Hid = new Controller();
// eslint-disable-next-line no-var
var HerculesMk2Hid = {};
HerculesMk2Hid.controls = [];
HerculesMk2Hid.leds = [];
HerculesMk2Hid.cache_in = [];
Expand Down
4 changes: 2 additions & 2 deletions res/controllers/Hercules-DJ-Console-RMX-hid-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
/* Based on zestoi's script */
/****************************************************************/

RMX = new Controller();

// eslint-disable-next-line no-var
var RMX = {};
RMX.controls = [];
RMX.leds = [];
RMX.cache_in = [];
Expand Down
101 changes: 101 additions & 0 deletions res/controllers/Hercules-DJ-Console-RMX-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,107 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/

// ----------------- Object definitions --------------------------



var ButtonState = {"released": 0x00, "pressed": 0x7F};

var LedState = {"off": 0x00, "on": 0x7F};

// Controller

var Controller = function() {
this.group = "[Master]";
this.Controls = [];
this.Buttons = [];
};

Controller.prototype.addButton = function(buttonName, button, eventHandler) {
if (eventHandler) {
/* eslint @typescript-eslint/no-this-alias: "off" */
const executionEnvironment = this;
const handler = function(value) {
button.state = value;
executionEnvironment[eventHandler](value);
};
button.handler = handler;
}
this.Buttons[buttonName] = button;
};


// Button

var Button = function(controlId) {
this.controlId = controlId;
this.state = ButtonState.released;
};
Button.prototype.handleEvent = function(value) {
this.handler(value);
};

// Control

var Control = function(mappedFunction, softMode) {
// These defaults are for MIDI controllers
this.minInput = 0;
this.midInput = 0x3F;
this.maxInput = 0x7F;
// ----

this.minOutput = -1.0;
this.midOutput = 0.0;
this.maxOutput = 1.0;
this.mappedFunction = mappedFunction;
this.softMode = softMode;
this.maxJump = 10;
};

Control.prototype.setValue = function(group, inputValue) {
let outputValue = 0;
if (inputValue <= this.midInput) {
outputValue = this.minOutput
+ ((inputValue - this.minInput) / (this.midInput - this.minInput))
* (this.midOutput - this.minOutput);
} else {
outputValue = this.midOutput
+ ((inputValue - this.midInput) / (this.maxInput - this.midInput))
* (this.maxOutput - this.midOutput);
}
if (this.softMode) {
const currentValue = engine.getValue(group, this.mappedFunction);
let currentRelative = 0.0;
if (currentValue <= this.midOutput) {
currentRelative = this.minInput
+ ((currentValue - this.minOutput) / (this.midOutput - this.minOutput))
* (this.midInput - this.minInput);
} else {
currentRelative = this.midInput
+ ((currentValue - this.midOutput) / (this.maxOutput - this.midOutput))
* (this.maxInput - this.midInput);
}
if (inputValue > currentRelative - this.maxJump
&& inputValue < currentRelative + this.maxJump) {
engine.setValue(group, this.mappedFunction, outputValue);
}
} else {
engine.setValue(group, this.mappedFunction, outputValue);
}
};

// Deck

var Deck = function(deckNumber, group) {
this.deckNumber = deckNumber;
this.group = group;
this.Buttons = [];
};

Deck.prototype.addButton = Controller.prototype.addButton;

// ----------------- END Object definitions ----------------------

//TODO: Cleanup, create objects from init.
//Remove led timers when alsa midi is working properly.
HerculesRMX = new Controller();
Expand Down
3 changes: 2 additions & 1 deletion res/controllers/Hercules-DJ-Control-MP3-hid-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
/* */
/****************************************************************/

HerculesMP3Hid = new Controller();
// eslint-disable-next-line no-var
var HerculesMP3Hid = {};
HerculesMP3Hid.controls = [];
HerculesMP3Hid.leds = [];
HerculesMP3Hid.cache_in = [];
Expand Down
4 changes: 3 additions & 1 deletion res/controllers/Kontrol-Dj-KDJ500-scripts.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
KDJ500 = new Controller();

// eslint-disable-next-line no-var
var KDJ500 = {};

KDJ500.init = function (id, debugging) {

Expand Down
5 changes: 3 additions & 2 deletions res/controllers/Novation-Launchpad-Mini-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,10 @@ function SeekKey(ch, pos) {
}
SeekKey.keys = new Array();

//Define the controller
// Define the controller
// eslint-disable-next-line no-var
var NLM = {};

NLM = new Controller();
NLM.init = function()
{
NLM.page = 0;
Expand Down
52 changes: 52 additions & 0 deletions res/controllers/Numark-NS7-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,58 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/

// ----------------- Object definitions --------------------------



var ButtonState = {"released": 0x00, "pressed": 0x7F};

var LedState = {"off": 0x00, "on": 0x7F};

// Controller

var Controller = function() {
this.group = "[Master]";
this.Buttons = [];
};

Controller.prototype.addButton = function(buttonName, button, eventHandler) {
if (eventHandler) {
/* eslint @typescript-eslint/no-this-alias: "off" */
const executionEnvironment = this;
const handler = function(value) {
button.state = value;
executionEnvironment[eventHandler](value);
};
button.handler = handler;
}
this.Buttons[buttonName] = button;
};

// Button

var Button = function(controlId) {
this.controlId = controlId;
this.state = ButtonState.released;
};
Button.prototype.handleEvent = function(value) {
this.handler(value);
};


// Deck

var Deck = function(deckNumber, group) {
this.deckNumber = deckNumber;
this.group = group;
this.Buttons = [];
};

Deck.prototype.addButton = Controller.prototype.addButton;

// ----------------- END Object definitions ----------------------

NumarkNS7 = new Controller();
NumarkNS7.RateRanges = [0.08, 0.10, 0.30, 1.00];

Expand Down
Loading