diff options
author | Ferran Pujol Camins <ferran.pujol@mytaxi.com> | 2020-03-27 20:30:44 +0100 |
---|---|---|
committer | Ferran Pujol Camins <ferran.pujol@mytaxi.com> | 2020-03-27 20:30:44 +0100 |
commit | 155f0667fb586ce4fcb084b81b9dd837a491e186 (patch) | |
tree | cabc91a23211748dd8d4413f7d5ad7d70aae6d09 /res/controllers/midi-components-0.0.js | |
parent | 9cdf435dac257e7e4a0598bac9491025b5605e64 (diff) | |
parent | 78a864081803709ed036771a0a87de0ebd79440b (diff) |
Merge branch 'master' into migrate-to-QJSEngine
# Conflicts:
# appveyor.yml
# build/depends.py
# res/controllers/midi-components-0.0.js
# src/controllers/controller.h
# src/controllers/controllerengine.h
# src/controllers/engine/colorjsproxy.cpp
# src/controllers/engine/controllerengine.cpp
# src/controllers/hid/hidcontroller.cpp
# src/preferences/dialog/dlgpreferences.cpp
# src/preferences/dialog/dlgpreferences.h
# src/skin/skincontext.cpp
# src/skin/skincontext.h
# src/test/controller_preset_validation_test.cpp
# src/test/controllerengine_test.cpp
Diffstat (limited to 'res/controllers/midi-components-0.0.js')
-rw-r--r-- | res/controllers/midi-components-0.0.js | 588 |
1 files changed, 294 insertions, 294 deletions
diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index 126d48bc1d..93a41a2a95 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -26,22 +26,22 @@ * the lodash.mixxx.js file in this directory for details. **/ -;(function (global) { - var Component = function (options) { - if (Array.isArray(options) && typeof options[0] === 'number') { +(function(global) { + var Component = function(options) { + if (Array.isArray(options) && typeof options[0] === "number") { this.midi = options; } else { _.assign(this, options); } - if (typeof this.unshift === 'function') { + if (typeof this.unshift === "function") { this.unshift(); } // These cannot be in the prototype; they must be unique to each instance. this.isShifted = false; this.connections = []; - if (options !== undefined && typeof options.key === 'string') { + if (options !== undefined && typeof options.key === "string") { this.inKey = options.key; this.outKey = options.key; } @@ -56,7 +56,7 @@ Component.prototype = { // default attributes // You should probably overwrite at least some of these. - inValueScale: function (value) { + inValueScale: function(value) { // Hack to get exact center of pots to return 0.5 if (value > (this.max / 2)) { return (value - 1) / (this.max - 1); @@ -65,11 +65,11 @@ } }, // map input in the XML file, not inValueScale - input: function (channel, control, value, status, group) { + input: function(channel, control, value, _status, _group) { this.inSetParameter(this.inValueScale(value)); }, - outValueScale: function (value) {return value * this.max;}, - output: function (value, group, control) { + outValueScale: function(value) { return value * this.max; }, + output: function(value, _group, _control) { this.send(this.outValueScale(value)); }, outConnect: true, @@ -79,39 +79,39 @@ // common functions // In most cases, you should not overwrite these. - inGetParameter: function () { + inGetParameter: function() { return engine.getParameter(this.group, this.inKey); }, - inSetParameter: function (value) { + inSetParameter: function(value) { engine.setParameter(this.group, this.inKey, value); }, - inGetValue: function () { + inGetValue: function() { return engine.getValue(this.group, this.inKey); }, - inSetValue: function (value) { + inSetValue: function(value) { engine.setValue(this.group, this.inKey, value); }, - inToggle: function () { - this.inSetValue( ! this.inGetValue()); + inToggle: function() { + this.inSetValue(!this.inGetValue()); }, - outGetParameter: function () { + outGetParameter: function() { return engine.getParameter(this.group, this.outKey); }, - outSetParameter: function (value) { + outSetParameter: function(value) { engine.setParameter(this.group, this.outKey, value); }, - outGetValue: function () { + outGetValue: function() { return engine.getValue(this.group, this.outKey); }, - outSetValue: function (value) { + outSetValue: function(value) { engine.setValue(this.group, this.outKey, value); }, - outToggle: function () { - this.outSetValue( ! this.outGetValue()); + outToggle: function() { + this.outSetValue(!this.outGetValue()); }, - connect: function () { + connect: function() { /** Override this method with a custom one to connect multiple Mixxx COs for a single Component. Add the connection objects to the this.connections array so they all get disconnected just @@ -122,20 +122,20 @@ if (undefined !== this.group && undefined !== this.outKey && undefined !== this.output && - typeof this.output === 'function') { + typeof this.output === "function") { this.connections[0] = engine.makeConnection(this.group, this.outKey, this.output.bind(this)); } }, - disconnect: function () { + disconnect: function() { if (this.connections[0] !== undefined) { - this.connections.forEach(function (conn) { + this.connections.forEach(function(conn) { conn.disconnect(); }); } }, trigger: function() { if (this.connections[0] !== undefined) { - this.connections.forEach(function (conn) { + this.connections.forEach(function(conn) { conn.trigger(); }); } @@ -144,7 +144,7 @@ sendShifted: false, shiftChannel: false, shiftControl: false, - send: function (value) { + send: function(value) { if (this.midi === undefined || this.midi[0] === undefined || this.midi[1] === undefined) { return; } @@ -159,7 +159,7 @@ }, }; - var Button = function (options) { + var Button = function(options) { Component.call(this, options); }; Button.prototype = new Component({ @@ -176,10 +176,10 @@ // in any Buttons that act differently with short and long presses // to keep the timeouts uniform. longPressTimeout: 275, - isPress: function (channel, control, value, status) { + isPress: function(channel, control, value, _status) { return value > 0; }, - input: function (channel, control, value, status, group) { + input: function(channel, control, value, status, _group) { if (this.type === undefined || this.type === this.types.push) { this.inSetValue(this.isPress(channel, control, value, status)); } else if (this.type === this.types.toggle) { @@ -190,7 +190,7 @@ if (this.isPress(channel, control, value, status)) { this.inToggle(); this.isLongPressed = false; - this.longPressTimer = engine.beginTimer(this.longPressTimeout, function () { + this.longPressTimer = engine.beginTimer(this.longPressTimeout, function() { this.isLongPressed = true; this.longPressTimer = 0; }.bind(this), true); @@ -206,61 +206,61 @@ } } }, - outValueScale: function (value) { + outValueScale: function(value) { return (value > 0) ? this.on : this.off; }, - shutdown: function () { + shutdown: function() { this.send(this.off); }, }); - var PlayButton = function (options) { + var PlayButton = function(options) { Button.call(this, options); }; PlayButton.prototype = new Button({ - unshift: function () { - this.inKey = 'play'; + unshift: function() { + this.inKey = "play"; }, - shift: function () { - this.inKey = 'reverse'; + shift: function() { + this.inKey = "reverse"; }, type: Button.prototype.types.toggle, - outKey: 'play_indicator', + outKey: "play_indicator", }); - var CueButton = function (options) { + var CueButton = function(options) { Button.call(this, options); }; CueButton.prototype = new Button({ - unshift: function () { - this.inKey = 'cue_default'; + unshift: function() { + this.inKey = "cue_default"; }, - shift: function () { + shift: function() { if (this.reverseRollOnShift) { - this.inKey = 'reverseroll'; + this.inKey = "reverseroll"; } else { - this.inKey = 'start_stop'; + this.inKey = "start_stop"; } }, - outKey: 'cue_indicator', + outKey: "cue_indicator", }); - var SyncButton = function (options) { + var SyncButton = function(options) { Button.call(this, options); }; SyncButton.prototype = new Button({ - unshift: function () { - this.input = function (channel, control, value, status, group) { + unshift: function() { + this.input = function(channel, control, value, status, _group) { if (this.isPress(channel, control, value, status)) { - if (engine.getValue(this.group, 'sync_enabled') === 0) { - engine.setValue(this.group, 'beatsync', 1); - this.longPressTimer = engine.beginTimer(this.longPressTimeout, function () { - engine.setValue(this.group, 'sync_enabled', 1); + if (engine.getValue(this.group, "sync_enabled") === 0) { + engine.setValue(this.group, "beatsync", 1); + this.longPressTimer = engine.beginTimer(this.longPressTimeout, function() { + engine.setValue(this.group, "sync_enabled", 1); this.longPressTimer = 0; }, true); } else { - engine.setValue(this.group, 'sync_enabled', 0); + engine.setValue(this.group, "sync_enabled", 0); } } else { if (this.longPressTimer !== 0) { @@ -270,141 +270,141 @@ } }; }, - shift: function () { - this.inKey = 'quantize'; + shift: function() { + this.inKey = "quantize"; this.type = Button.prototype.types.toggle; this.input = Button.prototype.input; }, - outKey: 'sync_enabled', + outKey: "sync_enabled", }); - var LoopToggleButton = function (options) { + var LoopToggleButton = function(options) { Button.call(this, options); }; LoopToggleButton.prototype = new Button({ - inKey: 'reloop_exit', - inValueScale: function () { + inKey: "reloop_exit", + inValueScale: function() { return 1; }, - outKey: 'loop_enabled', + outKey: "loop_enabled", }); - var HotcueButton = function (options) { + var HotcueButton = function(options) { if (options.number === undefined) { - print('ERROR: No hotcue number specified for new HotcueButton.'); + print("ERROR: No hotcue number specified for new HotcueButton."); return; } - if (options.colors !== undefined || options.sendRGB !== undefined) { - this.colorIdKey = 'hotcue_' + options.number + '_color_id'; - if (options.colors === undefined) { - options.colors = color.predefinedColorsList(); - } + if (options.colorMapper !== undefined || options.sendRGB !== undefined) { + this.colorKey = "hotcue_" + options.number + "_color"; } this.number = options.number; - this.outKey = 'hotcue_' + this.number + '_enabled'; + this.outKey = "hotcue_" + this.number + "_enabled"; Button.call(this, options); }; HotcueButton.prototype = new Button({ - unshift: function () { - this.inKey = 'hotcue_' + this.number + '_activate'; - }, - shift: function () { - this.inKey = 'hotcue_' + this.number + '_clear'; + unshift: function() { + this.inKey = "hotcue_" + this.number + "_activate"; }, - getColor: function() { - if (this.colorIdKey !== undefined) { - return color.predefinedColorFromId(engine.getValue(this.group,this.colorIdKey)); - } else { - return null; - } + shift: function() { + this.inKey = "hotcue_" + this.number + "_clear"; }, output: function(value) { var outval = this.outValueScale(value); - // WARNING: outputColor only handles hotcueColors + // NOTE: outputColor only handles hotcueColors // and there is no hotcueColor for turning the LED - // off. So the `send()` function is responsible for turning the + // off. So the `send()` function is responsible for turning the // actual LED off. - if (this.colorIdKey !== undefined && outval !== this.off) { - this.outputColor(engine.getValue(this.group, this.colorIdKey)); + if (this.colorKey !== undefined && outval !== this.off) { + this.outputColor(engine.getValue(this.group, this.colorKey)); } else { this.send(outval); } }, - outputColor: function (id) { - var color = this.colors[id]; - if (color instanceof Array) { - if (color.length !== 3) { - print("ERROR: invalid color array for id: " + id); - return; - } - if (this.sendRGB === undefined) { - print("ERROR: no function defined for sending RGB colors"); - return; - } - this.sendRGB(color); - } else if (typeof color === 'number') { - this.send(color); + outputColor: function(colorCode) { + // Sends the color from the colorCode to the controller. This + // method will not be called if no colorKey has been specified. + if (colorCode === undefined || colorCode < 0 || colorCode > 0xFFFFFF) { + print("Ignoring invalid color code '" + colorCode + "' in outputColor()"); + return; + } + + if (this.colorMapper !== undefined) { + // This HotcueButton holds a reference to a ColorMapper. This means + // that the controller only supports a fixed set of colors, so we + // get the MIDI value for the nearest supported color and send it. + var nearestColorValue = this.colorMapper.getValueForNearestColor(colorCode); + this.send(nearestColorValue); + } else { + // Since outputColor has been called but no ColorMapper is + // available, we can assume that controller supports arbitrary + // RGB color output. + this.sendRGB(colorCodeToObject(colorCode)); } }, + sendRGB: function(_colorObject) { + // This method needs to be overridden in controller mappings, + // because the procedure is controller-dependent. + throw Error("sendRGB(colorObject) not implemented - unable to send RGB colors!"); + }, connect: function() { Button.prototype.connect.call(this); // call parent connect - if (undefined !== this.group && this.colorIdKey !== undefined) { - this.connections[1] = engine.makeConnection(this.group, this.colorIdKey, function (id) { - if (engine.getValue(this.group,this.outKey)) { + if (undefined !== this.group && this.colorKey !== undefined) { + this.connections[1] = engine.makeConnection(this.group, this.colorKey, function(id) { + if (engine.getValue(this.group, this.outKey)) { this.outputColor(id); } }); } }, }); - var SamplerButton = function (options) { + var SamplerButton = function(options) { if (options.number === undefined) { - print('ERROR: No sampler number specified for new SamplerButton.'); + print("ERROR: No sampler number specified for new SamplerButton."); return; } this.volumeByVelocity = options.volumeByVelocity; this.number = options.number; - this.group = '[Sampler' + this.number + ']'; + this.group = "[Sampler" + this.number + "]"; Button.call(this, options); }; SamplerButton.prototype = new Button({ - unshift: function () { - this.input = function (channel, control, value, status, group) { + unshift: function() { + this.input = function(channel, control, value, status, _group) { if (this.isPress(channel, control, value, status)) { - if (engine.getValue(this.group, 'track_loaded') === 0) { - engine.setValue(this.group, 'LoadSelectedTrack', 1); + if (engine.getValue(this.group, "track_loaded") === 0) { + engine.setValue(this.group, "LoadSelectedTrack", 1); } else { if (this.volumeByVelocity) { - engine.setValue(this.group, 'volume', this.inValueScale(value)); + engine.setValue(this.group, "volume", this.inValueScale(value)); } - engine.setValue(this.group, 'cue_gotoandplay', 1); + engine.setValue(this.group, "cue_gotoandplay", 1); } } }; }, shift: function() { - this.input = function (channel, control, value, status, group) { + this.input = function(channel, control, value, status, _group) { if (this.isPress(channel, control, value, status)) { - if (engine.getValue(this.group, 'play') === 1) { - engine.setValue(this.group, 'play', 0); + if (engine.getValue(this.group, "play") === 1) { + engine.setValue(this.group, "play", 0); } else { - engine.setValue(this.group, 'eject', 1); + engine.setValue(this.group, "eject", 1); } } else { - if (engine.getValue(this.group, 'play') === 0) { - engine.setValue(this.group, 'eject', 0); + if (engine.getValue(this.group, "play") === 0) { + engine.setValue(this.group, "eject", 0); } } }; }, - output: function (value, group, control) { - if (engine.getValue(this.group, 'track_loaded') === 1) { + output: function(_value, _group, _control) { + if (engine.getValue(this.group, "track_loaded") === 1) { if (this.loaded === undefined) { this.send(this.on); } else { - if (engine.getValue(this.group, 'play') === 1) { + if (engine.getValue(this.group, "play") === 1) { if (this.looping !== undefined && - engine.getValue(this.group, 'repeat') === 1) { + engine.getValue(this.group, "repeat") === 1) { this.send(this.looping); } else { this.send(this.playing); @@ -422,33 +422,33 @@ } }, connect: function() { - this.connections[0] = engine.makeConnection(this.group, 'track_loaded', this.output.bind(this)); + this.connections[0] = engine.makeConnection(this.group, "track_loaded", this.output.bind(this)); if (this.playing !== undefined) { - this.connections[1] = engine.makeConnection(this.group, 'play', this.output.bind(this)); + this.connections[1] = engine.makeConnection(this.group, "play", this.output.bind(this)); } if (this.looping !== undefined) { - this.connections[2] = engine.makeConnection(this.group, 'repeat', this.output.bind(this)); + this.connections[2] = engine.makeConnection(this.group, "repeat", this.output.bind(this)); } }, outKey: null, // hack to get Component constructor to call connect() }); - var EffectAssignmentButton = function (options) { - options.key = 'group_' + options.group + '_enable'; - options.group = '[EffectRack1_EffectUnit' + options.effectUnit + ']'; + var EffectAssignmentButton = function(options) { + options.key = "group_" + options.group + "_enable"; + options.group = "[EffectRack1_EffectUnit" + options.effectUnit + "]"; Button.call(this, options); }; EffectAssignmentButton.prototype = new Button({ type: Button.prototype.types.toggle, }); - var Pot = function (options) { + var Pot = function(options) { Component.call(this, options); this.firstValueReceived = false; }; Pot.prototype = new Component({ - input: function (channel, control, value, status, group) { + input: function(channel, control, value, _status, _group) { if (this.MSB !== undefined) { value = (this.MSB << 7) + value; } @@ -463,7 +463,7 @@ } }, // Input handlers for 14 bit MIDI - inputMSB: function (channel, control, value, status, group) { + inputMSB: function(channel, control, value, status, group) { // For the first messages, disregard the LSB in case // the first LSB is received after the first MSB. if (this.MSB === undefined) { @@ -473,75 +473,75 @@ } this.MSB = value; }, - inputLSB: function (channel, control, value, status, group) { + inputLSB: function(channel, control, value, status, group) { // Make sure the first MSB has been received if (this.MSB !== undefined) { this.input(channel, control, value, status, group); } }, - connect: function () { + connect: function() { if (this.firstValueReceived && !this.relative) { engine.softTakeover(this.group, this.inKey, true); } }, - disconnect: function () { + disconnect: function() { if (!this.relative) { engine.softTakeoverIgnoreNextValue(this.group, this.inKey); } }, - trigger: function () {}, + trigger: function() {}, }); /** The generic Component code provides everything to implement an Encoder. This Encoder Component exists so instanceof can be used to separate Encoders from other Components. **/ - var Encoder = function (options) { + var Encoder = function(options) { Component.call(this, options); }; Encoder.prototype = new Component(); - var ComponentContainer = function (initialLayer) { - if (typeof initialLayer === 'object') { + var ComponentContainer = function(initialLayer) { + if (typeof initialLayer === "object") { this.applyLayer(initialLayer); } }; ComponentContainer.prototype = { - forEachComponent: function (operation, recursive) { - if (typeof operation !== 'function') { - print('ERROR: ComponentContainer.forEachComponent requires a function argument'); + forEachComponent: function(operation, recursive) { + if (typeof operation !== "function") { + print("ERROR: ComponentContainer.forEachComponent requires a function argument"); return; } if (recursive === undefined) { recursive = true; } var that = this; - var applyOperationTo = function (obj) { + var applyOperationTo = function(obj) { if (obj instanceof Component) { operation.call(that, obj); } else if (recursive && obj instanceof ComponentContainer) { obj.forEachComponent(operation); } else if (Array.isArray(obj)) { - obj.forEach(function (element) { + obj.forEach(function(element) { applyOperationTo(element); }); } }; for (var memberName in this) { - if (this.hasOwnProperty(memberName)) { + if (ComponentContainer.prototype.hasOwnProperty.call(this, memberName)) { applyOperationTo(this[memberName]); } } }, - forEachComponentContainer: function (operation, recursive) { - if (typeof operation !== 'function') { - print('ERROR: ComponentContainer.forEachComponentContainer requires a function argument'); + forEachComponentContainer: function(operation, recursive) { + if (typeof operation !== "function") { + print("ERROR: ComponentContainer.forEachComponentContainer requires a function argument"); return; } if (recursive === undefined) { recursive = true; } var that = this; - var applyOperationTo = function (obj) { + var applyOperationTo = function(obj) { if (obj instanceof ComponentContainer) { operation.call(that, obj); @@ -549,22 +549,22 @@ obj.forEachComponentContainer(operation); } } else if (Array.isArray(obj)) { - obj.forEach(function (element) { + obj.forEach(function(element) { applyOperationTo(element); }); } }; for (var memberName in this) { - if (this.hasOwnProperty(memberName)) { + if (ComponentContainer.prototype.hasOwnProperty.call(this, memberName)) { applyOperationTo(this[memberName]); } } }, - reconnectComponents: function (operation, recursive) { - this.forEachComponent(function (component) { + reconnectComponents: function(operation, recursive) { + this.forEachComponent(function(component) { component.disconnect(); - if (typeof operation === 'function') { + if (typeof operation === "function") { operation.call(this, component); } component.connect(); @@ -572,9 +572,9 @@ }, recursive); }, isShifted: false, - shift: function () { + shift: function() { // Shift direct child Components - this.forEachComponent(function (component) { + this.forEachComponent(function(component) { // Controls for push type Buttons depend on getting reset to 0 when the // Button is released for correct behavior. If there is a skin button // that lights up with the inKey, the skin button would stay lit if the @@ -584,13 +584,13 @@ // shifted state, and the unshifted inKey would not get reset to 0. // To work around this, reset push Buttons' inKey to 0 when the shift // button is pressed. - if (typeof component.shift === 'function') { + if (typeof component.shift === "function") { if (component instanceof Button && (component.type === Button.prototype.types.push || component.type === undefined) && component.input === Button.prototype.input - && typeof component.inKey === 'string' - && typeof component.group === 'string') { + && typeof component.inKey === "string" + && typeof component.group === "string") { if (engine.getValue(component.group, component.inKey) !== 0) { engine.setValue(component.group, component.inKey, 0); } @@ -600,24 +600,24 @@ }, false); // Shift child ComponentContainers - this.forEachComponentContainer(function (container) { + this.forEachComponentContainer(function(container) { container.shift(); }, false); // Set isShifted for each ComponentContainer recursively this.isShifted = true; }, - unshift: function () { + unshift: function() { // Unshift direct child Components - this.forEachComponent(function (component) { + this.forEachComponent(function(component) { // Refer to comment in ComponentContainer.shift() above for explanation - if (typeof component.unshift === 'function') { + if (typeof component.unshift === "function") { if (component instanceof Button && (component.type === Button.prototype.types.push || component.type === undefined) && component.input === Button.prototype.input - && typeof component.inKey === 'string' - && typeof component.group === 'string') { + && typeof component.inKey === "string" + && typeof component.group === "string") { if (engine.getValue(component.group, component.inKey) !== 0) { engine.setValue(component.group, component.inKey, 0); } @@ -627,19 +627,19 @@ }, false); // Unshift child ComponentContainers - this.forEachComponentContainer(function (container) { + this.forEachComponentContainer(function(container) { container.unshift(); }, false); // Unset isShifted for each ComponentContainer recursively this.isShifted = false; }, - applyLayer: function (newLayer, reconnectComponents) { + applyLayer: function(newLayer, reconnectComponents) { if (reconnectComponents !== false) { reconnectComponents = true; } if (reconnectComponents === true) { - this.forEachComponent(function (component) { + this.forEachComponent(function(component) { component.disconnect(); }); } @@ -647,51 +647,51 @@ _.merge(this, newLayer); if (reconnectComponents === true) { - this.forEachComponent(function (component) { + this.forEachComponent(function(component) { component.connect(); component.trigger(); }); } }, - shutdown: function () { - this.forEachComponent(function (component) { + shutdown: function() { + this.forEachComponent(function(component) { if (component.shutdown !== undefined - && typeof component.shutdown === 'function') { + && typeof component.shutdown === "function") { component.shutdown(); } - }) + }); }, }; - var Deck = function (deckNumbers) { + var Deck = function(deckNumbers) { if (deckNumbers !== undefined) { if (Array.isArray(deckNumbers)) { // These must be unique to each instance, // so they cannot be in the prototype. - this.currentDeck = '[Channel' + deckNumbers[0] + ']'; + this.currentDeck = "[Channel" + deckNumbers[0] + "]"; this.deckNumbers = deckNumbers; - } else if (typeof deckNumbers === 'number' && + } else if (typeof deckNumbers === "number" && Math.floor(deckNumbers) === deckNumbers && isFinite(deckNumbers)) { - this.currentDeck = '[Channel' + deckNumbers + ']'; + this.currentDeck = "[Channel" + deckNumbers + "]"; this.deckNumbers = [deckNumbers]; } } else { - print('ERROR! new Deck() called without specifying any deck numbers'); + print("ERROR! new Deck() called without specifying any deck numbers"); return; } }; Deck.prototype = new ComponentContainer({ - setCurrentDeck: function (newGroup) { + setCurrentDeck: function(newGroup) { this.currentDeck = newGroup; - this.reconnectComponents(function (component) { + this.reconnectComponents(function(component) { if (component.group === undefined || component.group.search(script.channelRegEx) !== -1) { component.group = newGroup; } else if (component.group.search(script.eqRegEx) !== -1) { - component.group = '[EqualizerRack1_' + newGroup + '_Effect1]'; + component.group = "[EqualizerRack1_" + newGroup + "_Effect1]"; } else if (component.group.search(script.quickEffectRegEx) !== -1) { - component.group = '[QuickEffectRack1_' + newGroup + ']'; + component.group = "[QuickEffectRack1_" + newGroup + "]"; } // Do not alter the Component's group if it does not match any of those RegExs. @@ -699,12 +699,12 @@ // The ControlObjects for assigning decks to effect units // indicate the effect unit with the group and the deck with the key, // so change the key here instead of the group. - component.inKey = 'group_' + newGroup + '_enable'; - component.outKey = 'group_' + newGroup + '_enable'; + component.inKey = "group_" + newGroup + "_enable"; + component.outKey = "group_" + newGroup + "_enable"; } }); }, - toggle: function () { + toggle: function() { // cycle through deckNumbers array var index = this.deckNumbers.indexOf(parseInt( script.channelRegEx.exec(this.currentDeck)[1] @@ -718,41 +718,41 @@ } }); - EffectUnit = function (unitNumbers, allowFocusWhenParametersHidden, colors) { + var EffectUnit = function(unitNumbers, allowFocusWhenParametersHidden, colors) { var eu = this; this.focusChooseModeActive = false; // This is only connected if allowFocusWhenParametersHidden is false. - this.onShowParametersChange = function (value) { + this.onShowParametersChange = function(value) { if (value === 0) { // Prevent this from getting called twice (on button down and button up) // when show_parameters button is clicked in skin. // Otherwise this.previouslyFocusedEffect would always be set to 0 // on the second call. - if (engine.getValue(eu.group, 'show_focus') > 0) { - engine.setValue(eu.group, 'show_focus', 0); + if (engine.getValue(eu.group, "show_focus") > 0) { + engine.setValue(eu.group, "show_focus", 0); eu.previouslyFocusedEffect = engine.getValue(eu.group, - "focused_effect"); + "focused_effect"); engine.setValue(eu.group, "focused_effect", 0); } } else { - engine.setValue(eu.group, 'show_focus', 1); + engine.setValue(eu.group, "show_focus", 1); if (eu.previouslyFocusedEffect !== undefined) { - engine.setValue(eu.group, 'focused_effect', - eu.previouslyFocusedEffect); + engine.setValue(eu.group, "focused_effect", + eu.previouslyFocusedEffect); } } if (eu.enableButtons !== undefined) { - eu.enableButtons.reconnectComponents(function (button) { + eu.enableButtons.reconnectComponents(function(button) { button.stopEffectFocusChooseMode(); |