From b677c529d756f32c52761abeed82b3e58bb2e5a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Reu=C3=9Fe?= Date: Sun, 6 May 2018 12:06:07 +0200 Subject: [PATCH 1/2] =?UTF-8?q?components.js:=20Don=E2=80=99t=20clobber=20?= =?UTF-8?q?component=20container=20groups?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since ‘forEachComponent’ evaluates callbacks within the context of the current component container, ‘this.currentDeck’ will be undefined after we recurse into a component container inside of the current deck. Instead, we now propagate the current deck downwards by referring to the argument ‘setCurrentDeck’ was invoked with. --- res/controllers/midi-components-0.0.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index 3f7f3b3dac..8ab3d2b8d0 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -578,11 +578,11 @@ this.currentDeck = newGroup; this.reconnectComponents(function (component) { if (component.group.search(script.channelRegEx) !== -1) { - component.group = this.currentDeck; + component.group = newGroup; } else if (component.group.search(script.eqRegEx) !== -1) { - component.group = '[EqualizerRack1_' + this.currentDeck + '_Effect1]'; + component.group = '[EqualizerRack1_' + newGroup + '_Effect1]'; } else if (component.group.search(script.quickEffectRegEx) !== -1) { - component.group = '[QuickEffectRack1_' + this.currentDeck + ']'; + component.group = '[QuickEffectRack1_' + newGroup + ']'; } // Do not alter the Component's group if it does not match any of those RegExs. From 5f604c0b88fd2d0d18e4d97fdb7c781cfd85f7b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Reu=C3=9Fe?= Date: Sun, 6 May 2018 14:51:48 +0200 Subject: [PATCH 2/2] =?UTF-8?q?components.js:=20Be=20more=20robust=20in=20?= =?UTF-8?q?=E2=80=98setCurrentDeck=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ‘component.group’ might be unset, in which case scripts will fail silently. Let’s guard against this case. --- res/controllers/midi-components-0.0.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index 8ab3d2b8d0..4e5dec43d1 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -577,7 +577,8 @@ setCurrentDeck: function (newGroup) { this.currentDeck = newGroup; this.reconnectComponents(function (component) { - if (component.group.search(script.channelRegEx) !== -1) { + 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]';