From 4af3741848c07b3f3ec912ee6c786867d2b624a7 Mon Sep 17 00:00:00 2001 From: be_ Date: Wed, 8 Mar 2017 12:19:03 -0600 Subject: [PATCH 01/15] Components: unfocus EffectUnit when show_parameters is set to 0 --- res/controllers/midi-components-0.0.js | 1 + 1 file changed, 1 insertion(+) diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index 0194c1fbbb13..a4d3b72140f9 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -614,6 +614,7 @@ this.send((value > 0) ? this.on : this.off); if (value === 0) { engine.setValue(this.group, "show_focus", 0); + engine.setValue(this.group, "focused_effect", 0); // NOTE: calling eu.reconnectComponents() here would cause an infinite loop when // calling EffectUnit.reconnectComponents(). eu.forEachComponent(function (c) { From 27703c8060396607264bae8b5a538ee83fafaa06 Mon Sep 17 00:00:00 2001 From: be_ Date: Fri, 17 Mar 2017 12:21:47 -0500 Subject: [PATCH 02/15] Components: add new EffectAssignmentButton Component that toggles with decks following Deere redesign to put effect unit assignment switches in decks instead of effect units also don't premake EffectUnit.enableOnChannelButtons --- res/controllers/common-controller-scripts.js | 2 ++ res/controllers/midi-components-0.0.js | 27 ++++++++++++-------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/res/controllers/common-controller-scripts.js b/res/controllers/common-controller-scripts.js index 5b4b94ae0efa..cce9e53641aa 100644 --- a/res/controllers/common-controller-scripts.js +++ b/res/controllers/common-controller-scripts.js @@ -388,6 +388,8 @@ script.samplerRegEx = /^\[Sampler(\d+)\]$/ ; script.channelRegEx = /^\[Channel(\d+)\]$/ ; script.eqRegEx = /^\[EqualizerRack1_(\[.*\])_Effect1\]$/ ; script.quickEffectRegEx = /^\[QuickEffectRack1_(\[.*\])\]$/ ; +script.effectUnitRegEx = /^\[EffectRack1_EffectUnit(\d+)\]$/ ; +script.individualEffectRegEx = /^\[EffectRack1_EffectUnit(\d+)_Effect(\d+)\]$/ ; // ----------------- Object definitions -------------------------- diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index a4d3b72140f9..1079606c550e 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -312,6 +312,13 @@ 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 + ']'; + Button.call(this, options); + }; + EffectAssignmentButton.prototype = new Button(); + var Pot = function (options) { Component.call(this, options); @@ -446,8 +453,15 @@ } else if (component.group.search(script.quickEffectRegEx) !== -1) { component.group = '[QuickEffectRack1_' + this.currentDeck + ']'; } - // Do not alter the Component's group if it does not match any of those RegExs because - // that could break effects Components. + // Do not alter the Component's group if it does not match any of those RegExs. + + if (component instanceof EffectAssignmentButton) { + // The ControlObjects for assinging 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'; + } }); }, toggle: function () { @@ -493,14 +507,6 @@ outConnect: false, }); }; - this.enableOnChannelButtons.addButton('Channel1'); - this.enableOnChannelButtons.addButton('Channel2'); - this.enableOnChannelButtons.addButton('Channel3'); - this.enableOnChannelButtons.addButton('Channel4'); - this.enableOnChannelButtons.addButton('Headphone'); - this.enableOnChannelButtons.addButton('Master'); - this.enableOnChannelButtons.addButton('Microphone'); - this.enableOnChannelButtons.addButton('Auxiliary1'); this.EffectUnitKnob = function (number) { this.number = number; @@ -670,6 +676,7 @@ exports.LoopToggleButton = LoopToggleButton; exports.HotcueButton = HotcueButton; exports.SamplerButton = SamplerButton; + exports.EffectAssignmentButton = EffectAssignmentButton; exports.Pot = Pot; exports.Encoder = Encoder; exports.ComponentContainer = ComponentContainer; From b8e0939678be9deb729d1f1793f12d532d532f95 Mon Sep 17 00:00:00 2001 From: be_ Date: Fri, 17 Mar 2017 12:22:11 -0500 Subject: [PATCH 03/15] Components: make EffectUnit togglable between effect units --- res/controllers/midi-components-0.0.js | 73 ++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 9 deletions(-) diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index 1079606c550e..57e8c9706ec7 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -436,10 +436,20 @@ }; var Deck = function (deckNumbers) { - if (deckNumbers !== undefined && Array.isArray(deckNumbers)) { - // These must be unique to each instance, so they cannot be in the prototype. - this.currentDeck = '[Channel' + deckNumbers[0] + ']'; - this.deckNumbers = 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.deckNumbers = deckNumbers; + } else if (typeof deckNumbers === 'number' && + Math.floor(deckNumbers) === deckNumbers && + isFinite(deckNumbers)) { + this.currentDeck = '[Channel' + deckNumbers + ']'; + this.deckNumbers = [deckNumbers]; + } + } else { + print('ERROR! new Deck() called without specifying any deck numbers'); } }; Deck.prototype = new ComponentContainer({ @@ -477,9 +487,52 @@ } }); - EffectUnit = function (unitNumber) { + EffectUnit = function (unitNumbers) { var eu = this; - this.group = '[EffectRack1_EffectUnit' + unitNumber + ']'; + + if (unitNumbers !== undefined) { + if (Array.isArray(unitNumbers)) { + this.group = '[EffectRack1_EffectUnit' + unitNumbers[0] + ']'; + this.currentUnitNumber = unitNumbers[0]; + this.unitNumbers = unitNumbers; + } else if (typeof unitNumbers === 'number' && + Math.floor(unitNumbers) === unitNumbers && + isFinite(unitNumbers)) { + this.group = '[EffectRack1_EffectUnit' + unitNumbers + ']'; + this.currentUnitNumber = unitNumbers; + this.unitNumbers = [unitNumbers]; + } + } else { + print('ERROR! new EffectUnit() called without specifying any unit numbers!'); + } + + this.setCurrentUnit = function (newNumber) { + this.currentUnitNumber = newNumber; + this.group = '[EffectRack1_EffectUnit' + newNumber + ']'; + this.reconnectComponents(function (component) { + var unitMatch = component.group.match(script.effectUnitRegEx); + if (unitMatch !== null) { + component.group = eu.group; + } else { + var effectMatch = component.group.match(script.individualEffectRegEx); + if (effectMatch !== null) { + component.group = '[EffectRack1_EffectUnit' + + eu.currentUnitNumber + + '_Effect' + effectMatch[2] + ']'; + } + } + }); + }; + + this.toggle = function () { + var index = this.unitNumbers.indexOf(this.currentUnitNumber); + if (index === (this.unitNumbers.length - 1)) { + index = 0; + } else { + index += 1; + } + this.setCurrentUnit(this.unitNumbers[index]); + } this.dryWetKnob = new Pot({ group: this.group, @@ -514,7 +567,8 @@ }; this.EffectUnitKnob.prototype = new Pot({ onParametersHide: function () { - this.group = '[EffectRack1_EffectUnit' + unitNumber + '_Effect' + this.number + ']'; + this.group = '[EffectRack1_EffectUnit' + eu.currentUnitNumber + '_Effect' + + this.number + ']'; this.inKey = 'meta'; }, onParametersShow: function () { @@ -523,7 +577,7 @@ // manipulate metaknobs this.onParametersHide(); } else { - this.group = '[EffectRack1_EffectUnit' + unitNumber + '_Effect' + + this.group = '[EffectRack1_EffectUnit' + this.unitNumber + '_Effect' + focusedEffect + ']'; this.inKey = 'parameter' + this.number; } @@ -532,7 +586,8 @@ this.EffectEnableButton = function (number) { this.number = number; - this.group = '[EffectRack1_EffectUnit' + unitNumber + '_Effect' + number + ']'; + this.group = '[EffectRack1_EffectUnit' + eu.currentUnitNumber + '_Effect' + + this.number + ']'; Button.call(this); }; this.EffectEnableButton.prototype = new Button({ From 165319d739e001417d82212f3aab5e0387242944 Mon Sep 17 00:00:00 2001 From: be_ Date: Fri, 17 Mar 2017 18:24:03 -0500 Subject: [PATCH 04/15] Components: rework EffectUnit UX Replace showParametersButton with focusEffectButton. This button's LED now indicates whether an effect is focused. * Short press, parameters hidden: show parameters * Short press, parameters showing: unfocus and hide parameters. The focused effect is remembered and restored the next time parameters are shown. * Long press, parameters hidden or showing: switch to effect focus choose mode In effect focus choose mode, the effect enable buttons act to select the focused effect. Their LEDs show whether that effect is focused. When focusEffectButton is released, the effect buttons go back to controlling the enable switches and their LEDs are updated to reflect which effects are enabled. --- res/controllers/midi-components-0.0.js | 204 +++++++++++++------------ 1 file changed, 103 insertions(+), 101 deletions(-) diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index 57e8c9706ec7..b3a02ea3dfe9 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -566,98 +566,73 @@ Pot.call(this); }; this.EffectUnitKnob.prototype = new Pot({ - onParametersHide: function () { - this.group = '[EffectRack1_EffectUnit' + eu.currentUnitNumber + '_Effect' + - this.number + ']'; - this.inKey = 'meta'; + group: this.group, + outKey: "focused_effect", + connect: function () { + if (this.firstValueReceived) { + engine.softTakeover(this.group, this.inKey, true); + } + this.connections[0] = engine.connectControl(eu.group, "focused_effect", + this.onFocusChange); + }, + disconnect: function () { + engine.softTakeoverIgnoreNextValue(this.group, this.inKey); + this.connections[0].disconnect(); }, - onParametersShow: function () { - var focusedEffect = engine.getValue(eu.group, "focused_effect"); - if (focusedEffect === 0) { - // manipulate metaknobs - this.onParametersHide(); + trigger: function () { + this.connections[0].trigger(); + }, + onFocusChange: function (value, group, control) { + if (value === 0) { + this.group = '[EffectRack1_EffectUnit' + + eu.currentUnitNumber + '_Effect' + + this.number + ']'; + this.inKey = 'meta'; + engine.softTakeoverIgnoreNextValue(this.group, this.inKey); } else { - this.group = '[EffectRack1_EffectUnit' + this.unitNumber + '_Effect' + - focusedEffect + ']'; + this.group = '[EffectRack1_EffectUnit' + eu.currentUnitNumber + + '_Effect' + value + ']'; this.inKey = 'parameter' + this.number; + engine.softTakeoverIgnoreNextValue(this.group, this.inKey); + } }, }); this.EffectEnableButton = function (number) { this.number = number; - this.group = '[EffectRack1_EffectUnit' + eu.currentUnitNumber + '_Effect' + - this.number + ']'; + this.group = '[EffectRack1_EffectUnit' + eu.currentUnitNumber + + '_Effect' + this.number + ']'; Button.call(this); }; this.EffectEnableButton.prototype = new Button({ - onParametersHide: function () { - this.input = Button.prototype.input; - this.outKey = 'enabled'; - this.unshift = function () { - this.isShifted = false; - this.inKey = 'enabled'; - this.onlyOnPress = true; - }; - this.shift = function () { - this.isShifted = true; - this.inKey = 'next_effect'; - this.onlyOnPress = false; - }; - if (this.isShifted) { - this.shift(); - } else { - this.unshift(); - } - }, - onParametersShow: function () { + stopEffectFocusChooseMode: function () { this.inKey = 'enabled'; this.outKey = 'enabled'; - this.unshift = function () { - this.isShifted = false; - this.input = Button.prototype.input; - this.onlyOnPress = true; - }; - this.shift = function () { - this.isShifted = true; - this.input = function (channel, control, value, status, group) { - if (this.isPress(channel, control, value, status)) { - if (engine.getValue(eu.group, "focused_effect") === this.number) { - // unfocus and make knobs control metaknobs - engine.setValue(eu.group, "focused_effect", 0); - } else { - // focus this effect - engine.setValue(eu.group, "focused_effect", this.number); - } + this.input = Button.prototype.input; + this.output = Button.prototype.output; + this.connect = Button.prototype.connect; + }, + startEffectFocusChooseMode: function () { + this.input = function (channel, control, value, status, group) { + if (this.isPress(channel, control, value, status)) { + if (engine.getValue(eu.group, "focused_effect") === this.number) { + // unfocus and make knobs control metaknobs + engine.setValue(eu.group, "focused_effect", 0); + } else { + // focus this effect + engine.setValue(eu.group, "focused_effect", this.number); } - }; + } }; this.connect = function () { - this.connections[0] = engine.connectControl(this.group, "enabled", Button.prototype.output); - this.connections[1] = engine.connectControl(eu.group, "focused_effect", this.onFocusChanged); + this.connections[0] = engine.connectControl(eu.group, + "focused_effect", + this.output); }; - this.onFocusChanged = function (value, group, control) { - if (value === this.number) { - // make knobs control first 3 parameters of the focused effect - eu.knobs.reconnectComponents(function (knob) { - if (typeof knob.onParametersShow === 'function') { - knob.onParametersShow(); // to set new group property - } - }); - } else if (value === 0) { - // make knobs control metaknobs - eu.knobs.reconnectComponents(function (knob) { - if (typeof knob.onParametersShow === 'function') { - knob.onParametersHide(); // to set new group property - } - }); - } + this.output = function (value, group, control) { + this.send(value === this.number); }; - if (this.isShifted) { - this.shift(); - } else { - this.unshift(); - } }, }); @@ -668,42 +643,69 @@ this.enableButtons[n] = new this.EffectEnableButton(n); } - this.showParametersButton = new Button({ + this.effectFocusButton = new Button({ group: this.group, - key: 'show_parameters', - output: function (value, group, control) { - this.send((value > 0) ? this.on : this.off); - if (value === 0) { - engine.setValue(this.group, "show_focus", 0); - engine.setValue(this.group, "focused_effect", 0); - // NOTE: calling eu.reconnectComponents() here would cause an infinite loop when - // calling EffectUnit.reconnectComponents(). - eu.forEachComponent(function (c) { - if (typeof c.onParametersHide === 'function') { - c.disconnect(); - c.onParametersHide(); - c.connect(); - c.trigger(); - } - }); + longPressed: false, + focusChooseMode: false, + longPressTimer: 0, + pressedWhenParametersHidden: false, + previouslyFocusedEffect: 0, + startEffectFocusChooseMode: function () { + this.focusChooseMode = true; + eu.enableButtons.reconnectComponents(function (button) { + button.startEffectFocusChooseMode(); + }); + }, + input: function (channel, control, value, status, group) { + var showParameters = engine.getValue(this.group, "show_parameters"); + if (value === 127) { + if (showParameters) { + this.longPressTimer = engine.beginTimer(275, + this.startEffectFocusChooseMode, + true); + } else { + engine.setValue(this.group, "show_parameters", 1); + engine.setValue(this.group, "show_focus", 1); + engine.setValue(this.group, "focused_effect", + this.previouslyFocusedEffect); + this.longPressTimer = engine.beginTimer(275, + this.startEffectFocusChooseMode, + true); + this.pressedWhenParametersHidden = true; + } } else { - engine.setValue(this.group, "show_focus", 1); - eu.forEachComponent(function (c) { - if (typeof c.onParametersShow === 'function') { - c.disconnect(); - c.onParametersShow(); - c.connect(); - c.trigger(); - } - }); + if (this.longPressTimer) { + engine.stopTimer(this.longPressTimer); + } + if (this.focusChooseMode) { + eu.enableButtons.reconnectComponents(function (button) { + button.stopEffectFocusChooseMode(); + }); + this.focusChooseMode = false; + } else if (showParameters && !this.pressedWhenParametersHidden) { + this.previouslyFocusedEffect = engine.getValue(this.group, + "focused_effect"); + engine.setValue(this.group, "focused_effect", 0); + engine.setValue(this.group, "show_focus", 0); + engine.setValue(this.group, "show_parameters", 0); + } + this.pressedWhenParametersHidden = false; } }, + outKey: 'focused_effect', + output: function (value, group, control) { + this.send((value > 0) ? this.on : this.off); + }, outConnect: false, }); this.init = function () { - this.showParametersButton.connect(); - this.showParametersButton.trigger(); + this.knobs.reconnectComponents(); + this.enableButtons.reconnectComponents(function (button) { + button.stopEffectFocusChooseMode(); + }); + this.effectFocusButton.connect(); + this.effectFocusButton.trigger(); this.enableOnChannelButtons.forEachComponent(function (button) { if (button.midi !== undefined) { From bace8b8aba9354a3a31c7e9065eaa6f0b0da7a16 Mon Sep 17 00:00:00 2001 From: be_ Date: Sat, 18 Mar 2017 20:31:13 -0500 Subject: [PATCH 05/15] Components: use shift + effectFocusButton to toggle EffectUnits --- res/controllers/midi-components-0.0.js | 73 +++++++++++++++----------- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index b3a02ea3dfe9..57dbc1c019ba 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -656,41 +656,50 @@ button.startEffectFocusChooseMode(); }); }, - input: function (channel, control, value, status, group) { - var showParameters = engine.getValue(this.group, "show_parameters"); - if (value === 127) { - if (showParameters) { - this.longPressTimer = engine.beginTimer(275, - this.startEffectFocusChooseMode, - true); + unshift: function () { + this.input = function (channel, control, value, status, group) { + var showParameters = engine.getValue(this.group, "show_parameters"); + if (this.isPress(channel, control, value, status)) { + if (showParameters) { + this.longPressTimer = engine.beginTimer(275, + this.startEffectFocusChooseMode, + true); + } else { + engine.setValue(this.group, "show_parameters", 1); + engine.setValue(this.group, "show_focus", 1); + engine.setValue(this.group, "focused_effect", + this.previouslyFocusedEffect); + this.longPressTimer = engine.beginTimer(275, + this.startEffectFocusChooseMode, + true); + this.pressedWhenParametersHidden = true; + } } else { - engine.setValue(this.group, "show_parameters", 1); - engine.setValue(this.group, "show_focus", 1); - engine.setValue(this.group, "focused_effect", - this.previouslyFocusedEffect); - this.longPressTimer = engine.beginTimer(275, - this.startEffectFocusChooseMode, - true); - this.pressedWhenParametersHidden = true; - } - } else { - if (this.longPressTimer) { - engine.stopTimer(this.longPressTimer); + if (this.longPressTimer) { + engine.stopTimer(this.longPressTimer); + } + if (this.focusChooseMode) { + eu.enableButtons.reconnectComponents(function (button) { + button.stopEffectFocusChooseMode(); + }); + this.focusChooseMode = false; + } else if (showParameters && !this.pressedWhenParametersHidden) { + this.previouslyFocusedEffect = engine.getValue(this.group, + "focused_effect"); + engine.setValue(this.group, "focused_effect", 0); + engine.setValue(this.group, "show_focus", 0); + engine.setValue(this.group, "show_parameters", 0); + } + this.pressedWhenParametersHidden = false; } - if (this.focusChooseMode) { - eu.enableButtons.reconnectComponents(function (button) { - button.stopEffectFocusChooseMode(); - }); - this.focusChooseMode = false; - } else if (showParameters && !this.pressedWhenParametersHidden) { - this.previouslyFocusedEffect = engine.getValue(this.group, - "focused_effect"); - engine.setValue(this.group, "focused_effect", 0); - engine.setValue(this.group, "show_focus", 0); - engine.setValue(this.group, "show_parameters", 0); + }; + }, + shift: function () { + this.input = function (channel, control, value, status, group) { + if (this.isPress(channel, control, value, status)) { + eu.toggle(); } - this.pressedWhenParametersHidden = false; - } + }; }, outKey: 'focused_effect', output: function (value, group, control) { From bf6a9d3a74cabbc182e348d4f5c81a8ab7af63cb Mon Sep 17 00:00:00 2001 From: be_ Date: Mon, 20 Mar 2017 12:43:06 -0500 Subject: [PATCH 06/15] Components: add option to EffectUnit to allow focus without parameters showing per @ronso0's request --- res/controllers/midi-components-0.0.js | 34 +++++++++++++++++++------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index 57dbc1c019ba..73932b50bf34 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -487,7 +487,7 @@ } }); - EffectUnit = function (unitNumbers) { + EffectUnit = function (unitNumbers, allowFocusWhenParametersHidden) { var eu = this; if (unitNumbers !== undefined) { @@ -506,6 +506,16 @@ print('ERROR! new EffectUnit() called without specifying any unit numbers!'); } + if (allowFocusWhenParametersHidden === undefined) { + allowFocusWhenParametersHidden = false; + if (engine.getValue(this.group, "show_parameters") === 0) { + engine.setValue(this.group, "focused_effect", 0); + engine.setValue(this.group, "show_focus", 0); + } + } else if (allowFocusWhenParametersHidden === true) { + engine.setValue(this.group, "show_focus", 1); + } + this.setCurrentUnit = function (newNumber) { this.currentUnitNumber = newNumber; this.group = '[EffectRack1_EffectUnit' + newNumber + ']'; @@ -665,10 +675,12 @@ this.startEffectFocusChooseMode, true); } else { - engine.setValue(this.group, "show_parameters", 1); - engine.setValue(this.group, "show_focus", 1); - engine.setValue(this.group, "focused_effect", - this.previouslyFocusedEffect); + if (!allowFocusWhenParametersHidden) { + engine.setValue(this.group, "focused_effect", + this.previouslyFocusedEffect); + engine.setValue(this.group, "show_parameters", 1); + engine.setValue(this.group, "show_focus", 1); + } this.longPressTimer = engine.beginTimer(275, this.startEffectFocusChooseMode, true); @@ -684,11 +696,15 @@ }); this.focusChooseMode = false; } else if (showParameters && !this.pressedWhenParametersHidden) { - this.previouslyFocusedEffect = engine.getValue(this.group, - "focused_effect"); - engine.setValue(this.group, "focused_effect", 0); - engine.setValue(this.group, "show_focus", 0); + if (!allowFocusWhenParametersHidden) { + this.previouslyFocusedEffect = engine.getValue(this.group, + "focused_effect"); + engine.setValue(this.group, "focused_effect", 0); + engine.setValue(this.group, "show_focus", 0); + } engine.setValue(this.group, "show_parameters", 0); + } else if (!showParameters && allowFocusWhenParametersHidden) { + engine.setValue(this.group, "show_parameters", 1); } this.pressedWhenParametersHidden = false; } From fb52bd78f6a9a10329d9e534296e90e53c1f60d1 Mon Sep 17 00:00:00 2001 From: be_ Date: Mon, 20 Mar 2017 13:25:51 -0500 Subject: [PATCH 07/15] Components: fix soft takeover for EffectUnit knobs --- res/controllers/midi-components-0.0.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index 73932b50bf34..6da687004e31 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -580,7 +580,7 @@ outKey: "focused_effect", connect: function () { if (this.firstValueReceived) { - engine.softTakeover(this.group, this.inKey, true); + } this.connections[0] = engine.connectControl(eu.group, "focused_effect", this.onFocusChange); @@ -604,7 +604,6 @@ '_Effect' + value + ']'; this.inKey = 'parameter' + this.number; engine.softTakeoverIgnoreNextValue(this.group, this.inKey); - } }, }); @@ -650,6 +649,12 @@ this.enableButtons = new ComponentContainer(); for (var n = 1; n <= 3; n++) { this.knobs[n] = new this.EffectUnitKnob(n); + var effect = '[EffectRack1_EffectUnit' + this.currentUnitNumber + + '_Effect' + n + ']'; + engine.softTakeover(effect, 'meta', true); + engine.softTakeover(effect, 'parameter1', true); + engine.softTakeover(effect, 'parameter2', true); + engine.softTakeover(effect, 'parameter3', true); this.enableButtons[n] = new this.EffectEnableButton(n); } From 3bb042615ff9ad6e27e5ded7f1bf34c3ae2b5023 Mon Sep 17 00:00:00 2001 From: be_ Date: Mon, 20 Mar 2017 13:26:11 -0500 Subject: [PATCH 08/15] Components: provide common longPressTimeout on Button prototype --- res/controllers/midi-components-0.0.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index 6da687004e31..1d7ee4cf2afb 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -161,6 +161,12 @@ onlyOnPress: true, on: 127, off: 0, + // Time in milliseconds to distinguish a short press from a long press + // In the provided Components, only EffectUnit.effectFocusButton uses + // this, but it is recommended to refer to it (as this.longPressTimeout) + // in any custom Buttons that act differently with short and long presses + // to keep the timeouts uniform. + longPressTimeout: 275, isPress: function (channel, control, value, status) { return value > 0; }, @@ -676,7 +682,7 @@ var showParameters = engine.getValue(this.group, "show_parameters"); if (this.isPress(channel, control, value, status)) { if (showParameters) { - this.longPressTimer = engine.beginTimer(275, + this.longPressTimer = engine.beginTimer(this.longPressTimeout, this.startEffectFocusChooseMode, true); } else { @@ -686,7 +692,7 @@ engine.setValue(this.group, "show_parameters", 1); engine.setValue(this.group, "show_focus", 1); } - this.longPressTimer = engine.beginTimer(275, + this.longPressTimer = engine.beginTimer(this.longPressTimeout, this.startEffectFocusChooseMode, true); this.pressedWhenParametersHidden = true; From a29da73daae8d0e29c1e8545e62c69529c90f86a Mon Sep 17 00:00:00 2001 From: be_ Date: Mon, 20 Mar 2017 15:31:45 -0500 Subject: [PATCH 09/15] Components code cleanup and comments --- res/controllers/midi-components-0.0.js | 75 +++++++++++++++----------- 1 file changed, 45 insertions(+), 30 deletions(-) diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index 1d7ee4cf2afb..c5be5d7ae25a 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -247,7 +247,8 @@ var HotcueButton = function (options) { if (options.number === undefined) { - print('WARNING: No hotcue number specified for new HotcueButton.'); + print('ERROR: No hotcue number specified for new HotcueButton.'); + return; } this.number = options.number; this.outKey = 'hotcue_' + this.number + '_enabled'; @@ -265,7 +266,8 @@ var SamplerButton = function (options) { if (options.number === undefined) { - print('WARNING: No sampler number specified for new SamplerButton.'); + print('ERROR: No sampler number specified for new SamplerButton.'); + return; } this.number = options.number; this.group = '[Sampler' + this.number + ']'; @@ -456,6 +458,7 @@ } } else { print('ERROR! new Deck() called without specifying any deck numbers'); + return; } }; Deck.prototype = new ComponentContainer({ @@ -481,6 +484,7 @@ }); }, toggle: function () { + // cycle through deckNumbers array var index = this.deckNumbers.indexOf(parseInt( script.channelRegEx.exec(this.currentDeck)[1] )); @@ -510,26 +514,28 @@ } } else { print('ERROR! new EffectUnit() called without specifying any unit numbers!'); + return; } - if (allowFocusWhenParametersHidden === undefined) { - allowFocusWhenParametersHidden = false; + if (allowFocusWhenParametersHidden === true) { + engine.setValue(this.group, "show_focus", 1); + } else { if (engine.getValue(this.group, "show_parameters") === 0) { engine.setValue(this.group, "focused_effect", 0); engine.setValue(this.group, "show_focus", 0); } - } else if (allowFocusWhenParametersHidden === true) { - engine.setValue(this.group, "show_focus", 1); } this.setCurrentUnit = function (newNumber) { this.currentUnitNumber = newNumber; this.group = '[EffectRack1_EffectUnit' + newNumber + ']'; this.reconnectComponents(function (component) { + // update [EffectRack1_EffectUnitX] groups var unitMatch = component.group.match(script.effectUnitRegEx); if (unitMatch !== null) { component.group = eu.group; } else { + // update [EffectRack1_EffectUnitX_EffectY] groups var effectMatch = component.group.match(script.individualEffectRegEx); if (effectMatch !== null) { component.group = '[EffectRack1_EffectUnit' + @@ -541,6 +547,7 @@ }; this.toggle = function () { + // cycle through unitNumbers array var index = this.unitNumbers.indexOf(this.currentUnitNumber); if (index === (this.unitNumbers.length - 1)) { index = 0; @@ -563,7 +570,11 @@ // for soft takeover this.disconnect(); this.connect(); - eu.knobs.reconnectComponents(); + // engine.softTakeoverIgnoreNextValue is called + // in the knobs' onFocusChange function + eu.knobs.forEachComponent(function (knob) { + knob.trigger(); + }); }, outConnect: false, }); @@ -583,11 +594,16 @@ }; this.EffectUnitKnob.prototype = new Pot({ group: this.group, + input: function (channel, control, value, status, group) { + this.inSetParameter(this.inValueScale(value)); + // Unlike the Pot prototype, do not enable soft takeover here + // because soft takeover needs to be enabled for all the + // metaknobs and parameters 1-3 of all 3 effects. Instead, enabling + // soft takeover is handled below in the loop that calls the + // EffectUnitKnob constructor. + }, outKey: "focused_effect", connect: function () { - if (this.firstValueReceived) { - - } this.connections[0] = engine.connectControl(eu.group, "focused_effect", this.onFocusChange); }, @@ -625,8 +641,8 @@ this.inKey = 'enabled'; this.outKey = 'enabled'; this.input = Button.prototype.input; - this.output = Button.prototype.output; this.connect = Button.prototype.connect; + this.output = Button.prototype.output; }, startEffectFocusChooseMode: function () { this.input = function (channel, control, value, status, group) { @@ -667,12 +683,12 @@ this.effectFocusButton = new Button({ group: this.group, longPressed: false, - focusChooseMode: false, + focusChooseModeActive: false, longPressTimer: 0, pressedWhenParametersHidden: false, previouslyFocusedEffect: 0, startEffectFocusChooseMode: function () { - this.focusChooseMode = true; + this.focusChooseModeActive = true; eu.enableButtons.reconnectComponents(function (button) { button.startEffectFocusChooseMode(); }); @@ -681,41 +697,40 @@ this.input = function (channel, control, value, status, group) { var showParameters = engine.getValue(this.group, "show_parameters"); if (this.isPress(channel, control, value, status)) { - if (showParameters) { - this.longPressTimer = engine.beginTimer(this.longPressTimeout, + this.longPressTimer = engine.beginTimer(this.longPressTimeout, this.startEffectFocusChooseMode, true); - } else { + if (!showParameters) { if (!allowFocusWhenParametersHidden) { engine.setValue(this.group, "focused_effect", this.previouslyFocusedEffect); engine.setValue(this.group, "show_parameters", 1); engine.setValue(this.group, "show_focus", 1); } - this.longPressTimer = engine.beginTimer(this.longPressTimeout, - this.startEffectFocusChooseMode, - true); this.pressedWhenParametersHidden = true; } } else { if (this.longPressTimer) { engine.stopTimer(this.longPressTimer); } - if (this.focusChooseMode) { + + if (this.focusChooseModeActive) { eu.enableButtons.reconnectComponents(function (button) { button.stopEffectFocusChooseMode(); }); - this.focusChooseMode = false; - } else if (showParameters && !this.pressedWhenParametersHidden) { - if (!allowFocusWhenParametersHidden) { - this.previouslyFocusedEffect = engine.getValue(this.group, - "focused_effect"); - engine.setValue(this.group, "focused_effect", 0); - engine.setValue(this.group, "show_focus", 0); + this.focusChooseModeActive = false; + } else { + if (!showParameters && allowFocusWhenParametersHidden) { + engine.setValue(this.group, "show_parameters", 1); + } else if (showParameters && !this.pressedWhenParametersHidden) { + if (!allowFocusWhenParametersHidden) { + this.previouslyFocusedEffect = engine.getValue(this.group, + "focused_effect"); + engine.setValue(this.group, "focused_effect", 0); + engine.setValue(this.group, "show_focus", 0); + } + engine.setValue(this.group, "show_parameters", 0); } - engine.setValue(this.group, "show_parameters", 0); - } else if (!showParameters && allowFocusWhenParametersHidden) { - engine.setValue(this.group, "show_parameters", 1); } this.pressedWhenParametersHidden = false; } From 62758783be37fed74456ac609ff9f0178ad7ed15 Mon Sep 17 00:00:00 2001 From: be_ Date: Tue, 21 Mar 2017 21:57:19 -0500 Subject: [PATCH 10/15] Components EffectUnit refactor to solve some bugs Move some initialization code into EffectUnit.setCurrentUnit and call setCurrentUnit on construction to ensure that state of show_focus and show_parameters are set correctly when toggling units. Also refactor code for showing/hiding focus controls in skin to a callback connected to show_parameters so it gets triggered by clicking the show_parameters button in skins as well as effectFocusButton on the controller. --- res/controllers/midi-components-0.0.js | 110 ++++++++++++++++--------- 1 file changed, 71 insertions(+), 39 deletions(-) diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index c5be5d7ae25a..44173167c772 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -500,35 +500,63 @@ EffectUnit = function (unitNumbers, allowFocusWhenParametersHidden) { var eu = this; - if (unitNumbers !== undefined) { - if (Array.isArray(unitNumbers)) { - this.group = '[EffectRack1_EffectUnit' + unitNumbers[0] + ']'; - this.currentUnitNumber = unitNumbers[0]; - this.unitNumbers = unitNumbers; - } else if (typeof unitNumbers === 'number' && - Math.floor(unitNumbers) === unitNumbers && - isFinite(unitNumbers)) { - this.group = '[EffectRack1_EffectUnit' + unitNumbers + ']'; - this.currentUnitNumber = unitNumbers; - this.unitNumbers = [unitNumbers]; - } - } else { - print('ERROR! new EffectUnit() called without specifying any unit numbers!'); - return; - } - - if (allowFocusWhenParametersHidden === true) { - engine.setValue(this.group, "show_focus", 1); - } else { - if (engine.getValue(this.group, "show_parameters") === 0) { - engine.setValue(this.group, "focused_effect", 0); - engine.setValue(this.group, "show_focus", 0); + // This is only connected if allowFocusWhenParametersHidden is false. + 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(this.group, 'show_focus') > 0) { + engine.setValue(this.group, 'show_focus', 0); + this.previouslyFocusedEffect = engine.getValue(this.group, + "focused_effect"); + engine.setValue(this.group, "focused_effect", 0); + } + } else { + engine.setValue(this.group, 'show_focus', 1); + if (this.previouslyFocusedEffect !== undefined) { + engine.setValue(this.group, 'focused_effect', + this.previouslyFocusedEffect); + } } - } + }; this.setCurrentUnit = function (newNumber) { this.currentUnitNumber = newNumber; + if (allowFocusWhenParametersHidden) { + engine.setValue(this.group, 'show_focus', 0); + } else { + if (this.showParametersConnection !== undefined) { + this.showParametersConnection.disconnect(); + } + delete this.previouslyFocusedEffect; + } + this.group = '[EffectRack1_EffectUnit' + newNumber + ']'; + + if (allowFocusWhenParametersHidden) { + engine.setValue(this.group, 'show_focus', 1); + } else { + // Connect a callback to show_parameters changing instead of + // setting show_focus when effectFocusButton is pressed so + // show_focus is always in the correct state, even if the user + // presses the skin button for show_parameters. + this.showParametersConnection = engine.connectControl(this.group, + 'show_parameters', + this.onShowParametersChange); + this.showParametersConnection.trigger(); + } + + for (var n = 1; n <= 3; n++) { + var effect = '[EffectRack1_EffectUnit' + this.currentUnitNumber + + '_Effect' + n + ']'; + engine.softTakeover(effect, 'meta', true); + engine.softTakeover(effect, 'parameter1', true); + engine.softTakeover(effect, 'parameter2', true); + engine.softTakeover(effect, 'parameter3', true); + } + this.reconnectComponents(function (component) { // update [EffectRack1_EffectUnitX] groups var unitMatch = component.group.match(script.effectUnitRegEx); @@ -557,6 +585,21 @@ this.setCurrentUnit(this.unitNumbers[index]); } + if (unitNumbers !== undefined) { + if (Array.isArray(unitNumbers)) { + this.unitNumbers = unitNumbers; + this.setCurrentUnit(unitNumbers[0]); + } else if (typeof unitNumbers === 'number' && + Math.floor(unitNumbers) === unitNumbers && + isFinite(unitNumbers)) { + this.unitNumbers = [unitNumbers]; + this.setCurrentUnit(unitNumbers); + } + } else { + print('ERROR! new EffectUnit() called without specifying any unit numbers!'); + return; + } + this.dryWetKnob = new Pot({ group: this.group, unshift: function () { @@ -671,12 +714,6 @@ this.enableButtons = new ComponentContainer(); for (var n = 1; n <= 3; n++) { this.knobs[n] = new this.EffectUnitKnob(n); - var effect = '[EffectRack1_EffectUnit' + this.currentUnitNumber + - '_Effect' + n + ']'; - engine.softTakeover(effect, 'meta', true); - engine.softTakeover(effect, 'parameter1', true); - engine.softTakeover(effect, 'parameter2', true); - engine.softTakeover(effect, 'parameter3', true); this.enableButtons[n] = new this.EffectEnableButton(n); } @@ -702,10 +739,9 @@ true); if (!showParameters) { if (!allowFocusWhenParametersHidden) { - engine.setValue(this.group, "focused_effect", - this.previouslyFocusedEffect); engine.setValue(this.group, "show_parameters", 1); - engine.setValue(this.group, "show_focus", 1); + // eu.onShowParametersChange will refocus the + // previously focused effect and show focus in skin } this.pressedWhenParametersHidden = true; } @@ -723,13 +759,9 @@ if (!showParameters && allowFocusWhenParametersHidden) { engine.setValue(this.group, "show_parameters", 1); } else if (showParameters && !this.pressedWhenParametersHidden) { - if (!allowFocusWhenParametersHidden) { - this.previouslyFocusedEffect = engine.getValue(this.group, - "focused_effect"); - engine.setValue(this.group, "focused_effect", 0); - engine.setValue(this.group, "show_focus", 0); - } engine.setValue(this.group, "show_parameters", 0); + // eu.onShowParametersChange will save the focused effect, + // unfocus, and hide focus buttons in skin } } this.pressedWhenParametersHidden = false; From f99d7792e0b65c38906343e306bc6317afe443bd Mon Sep 17 00:00:00 2001 From: be_ Date: Fri, 24 Mar 2017 12:17:58 -0500 Subject: [PATCH 11/15] Components: add selecting next effect back to shift + enableButton --- res/controllers/midi-components-0.0.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index 44173167c772..770fbdb1851f 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -499,6 +499,7 @@ EffectUnit = function (unitNumbers, allowFocusWhenParametersHidden) { var eu = this; + this.focusChooseModeActive = false; // This is only connected if allowFocusWhenParametersHidden is false. this.onShowParametersChange = function (value) { @@ -682,6 +683,7 @@ this.EffectEnableButton.prototype = new Button({ stopEffectFocusChooseMode: function () { this.inKey = 'enabled'; + this.onlyOnPress = true; this.outKey = 'enabled'; this.input = Button.prototype.input; this.connect = Button.prototype.connect; @@ -708,6 +710,18 @@ this.send(value === this.number); }; }, + unshift: function () { + if (eu.focusChooseModeActive) { + this.startEffectFocusChooseMode(); + } else { + this.stopEffectFocusChooseMode(); + } + }, + shift: function () { + this.inKey = 'next_effect'; + this.onlyOnPress = false; + this.input = Button.prototype.input; + }, }); this.knobs = new ComponentContainer(); @@ -720,12 +734,11 @@ this.effectFocusButton = new Button({ group: this.group, longPressed: false, - focusChooseModeActive: false, longPressTimer: 0, pressedWhenParametersHidden: false, previouslyFocusedEffect: 0, startEffectFocusChooseMode: function () { - this.focusChooseModeActive = true; + eu.focusChooseModeActive = true; eu.enableButtons.reconnectComponents(function (button) { button.startEffectFocusChooseMode(); }); @@ -750,11 +763,11 @@ engine.stopTimer(this.longPressTimer); } - if (this.focusChooseModeActive) { + if (eu.focusChooseModeActive) { eu.enableButtons.reconnectComponents(function (button) { button.stopEffectFocusChooseMode(); }); - this.focusChooseModeActive = false; + eu.focusChooseModeActive = false; } else { if (!showParameters && allowFocusWhenParametersHidden) { engine.setValue(this.group, "show_parameters", 1); From 09112fb9fb3ed9720c6bea5716ed5cf0caa6c878 Mon Sep 17 00:00:00 2001 From: be_ Date: Mon, 10 Apr 2017 23:58:18 -0500 Subject: [PATCH 12/15] Components: change effects in EffectUnit by shift + knob turn and remove changing effects from shift + button press --- res/controllers/midi-components-0.0.js | 49 +++++++++++++++----------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index 770fbdb1851f..8d68432f1d52 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -638,13 +638,35 @@ }; this.EffectUnitKnob.prototype = new Pot({ group: this.group, - input: function (channel, control, value, status, group) { - this.inSetParameter(this.inValueScale(value)); - // Unlike the Pot prototype, do not enable soft takeover here - // because soft takeover needs to be enabled for all the - // metaknobs and parameters 1-3 of all 3 effects. Instead, enabling - // soft takeover is handled below in the loop that calls the - // EffectUnitKnob constructor. + unshift: function () { + this.input = function (channel, control, value, status, group) { + this.inSetParameter(this.inValueScale(value)); + // Unlike the Pot prototype, do not enable soft takeover here + // because soft takeover needs to be enabled for all the + // metaknobs and parameters 1-3 of all 3 effects. Instead, enabling + // soft takeover is handled in the loop that calls the + // EffectUnitKnob constructor. + this.previousValueReceived = value; + }; + }, + shift: function () { + this.valueAtLastEffectSwitch = this.previousValueReceived; + // Floor the threshold to ensure that every effect can be selected + this.changeThreshold = Math.floor(this.max / + engine.getValue('[Master]', 'num_effectsavailable')); + + this.input = function (channel, control, value, status, group) { + var change = value - this.valueAtLastEffectSwitch; + if (Math.abs(change) >= this.changeThreshold) { + var effectGroup = '[EffectRack1_EffectUnit' + + eu.currentUnitNumber + '_Effect' + + this.number + ']'; + engine.setValue(effectGroup, 'effect_selector', change); + this.valueAtLastEffectSwitch = value; + } + + this.previousValueReceived = value; + }; }, outKey: "focused_effect", connect: function () { @@ -683,7 +705,6 @@ this.EffectEnableButton.prototype = new Button({ stopEffectFocusChooseMode: function () { this.inKey = 'enabled'; - this.onlyOnPress = true; this.outKey = 'enabled'; this.input = Button.prototype.input; this.connect = Button.prototype.connect; @@ -710,18 +731,6 @@ this.send(value === this.number); }; }, - unshift: function () { - if (eu.focusChooseModeActive) { - this.startEffectFocusChooseMode(); - } else { - this.stopEffectFocusChooseMode(); - } - }, - shift: function () { - this.inKey = 'next_effect'; - this.onlyOnPress = false; - this.input = Button.prototype.input; - }, }); this.knobs = new ComponentContainer(); From 3adf63225b3ae4a9899bc56da3361762079b9f0f Mon Sep 17 00:00:00 2001 From: be_ Date: Tue, 11 Apr 2017 10:30:22 -0500 Subject: [PATCH 13/15] Components: fix loading of initial values for EffectUnit knobs --- res/controllers/midi-components-0.0.js | 37 ++++++++++++++++---------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index 8d68432f1d52..f4803156423c 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -549,13 +549,17 @@ this.showParametersConnection.trigger(); } - for (var n = 1; n <= 3; n++) { - var effect = '[EffectRack1_EffectUnit' + this.currentUnitNumber + - '_Effect' + n + ']'; - engine.softTakeover(effect, 'meta', true); - engine.softTakeover(effect, 'parameter1', true); - engine.softTakeover(effect, 'parameter2', true); - engine.softTakeover(effect, 'parameter3', true); + // Do not enable soft takeover upon EffectUnit construction + // so initial values can be loaded from knobs. + if (this.hasInitialized === true) { + for (var n = 1; n <= 3; n++) { + var effect = '[EffectRack1_EffectUnit' + this.currentUnitNumber + + '_Effect' + n + ']'; + engine.softTakeover(effect, 'meta', true); + engine.softTakeover(effect, 'parameter1', true); + engine.softTakeover(effect, 'parameter2', true); + engine.softTakeover(effect, 'parameter3', true); + } } this.reconnectComponents(function (component) { @@ -641,11 +645,15 @@ unshift: function () { this.input = function (channel, control, value, status, group) { this.inSetParameter(this.inValueScale(value)); - // Unlike the Pot prototype, do not enable soft takeover here - // because soft takeover needs to be enabled for all the - // metaknobs and parameters 1-3 of all 3 effects. Instead, enabling - // soft takeover is handled in the loop that calls the - // EffectUnitKnob constructor. + + if (this.previousValueReceived === undefined) { + var effect = '[EffectRack1_EffectUnit' + eu.currentUnitNumber + + '_Effect' + this.number + ']'; + engine.softTakeover(effect, 'meta', true); + engine.softTakeover(effect, 'parameter1', true); + engine.softTakeover(effect, 'parameter2', true); + engine.softTakeover(effect, 'parameter3', true); + } this.previousValueReceived = value; }; }, @@ -686,13 +694,12 @@ eu.currentUnitNumber + '_Effect' + this.number + ']'; this.inKey = 'meta'; - engine.softTakeoverIgnoreNextValue(this.group, this.inKey); } else { this.group = '[EffectRack1_EffectUnit' + eu.currentUnitNumber + '_Effect' + value + ']'; this.inKey = 'parameter' + this.number; - engine.softTakeoverIgnoreNextValue(this.group, this.inKey); } + engine.softTakeoverIgnoreNextValue(this.group, this.inKey); }, }); @@ -825,6 +832,8 @@ component.group = eu.group; } }); + + this.hasInitialized = true; }; }; EffectUnit.prototype = new ComponentContainer(); From c9fa1d634abd0fb6bbdfdcd91ffcd1be14dea714 Mon Sep 17 00:00:00 2001 From: be_ Date: Thu, 13 Apr 2017 12:06:49 -0500 Subject: [PATCH 14/15] Components: support 14 bit EffectUnitKnobs --- res/controllers/midi-components-0.0.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index f4803156423c..479894fe397f 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -644,6 +644,9 @@ group: this.group, unshift: function () { this.input = function (channel, control, value, status, group) { + if (this.MSB !== undefined) { + value = this.MSB << 7 + value; + } this.inSetParameter(this.inValueScale(value)); if (this.previousValueReceived === undefined) { @@ -664,6 +667,9 @@ engine.getValue('[Master]', 'num_effectsavailable')); this.input = function (channel, control, value, status, group) { + if (this.MSB !== undefined) { + value = this.MSB << 7 + value; + } var change = value - this.valueAtLastEffectSwitch; if (Math.abs(change) >= this.changeThreshold) { var effectGroup = '[EffectRack1_EffectUnit' + From d141c891ba0ee8223437e41d04bb9c475c0d10a1 Mon Sep 17 00:00:00 2001 From: be_ Date: Thu, 27 Apr 2017 11:32:36 -0500 Subject: [PATCH 15/15] Components: fix order of operations for 14 bit MIDI EffectUnitKnobs --- res/controllers/midi-components-0.0.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index 479894fe397f..9678dd2b8022 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -645,7 +645,7 @@ unshift: function () { this.input = function (channel, control, value, status, group) { if (this.MSB !== undefined) { - value = this.MSB << 7 + value; + value = (this.MSB << 7) + value; } this.inSetParameter(this.inValueScale(value)); @@ -668,7 +668,7 @@ this.input = function (channel, control, value, status, group) { if (this.MSB !== undefined) { - value = this.MSB << 7 + value; + value = (this.MSB << 7) + value; } var change = value - this.valueAtLastEffectSwitch; if (Math.abs(change) >= this.changeThreshold) {