diff options
author | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2020-07-17 11:49:11 +0200 |
---|---|---|
committer | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2020-07-17 11:49:11 +0200 |
commit | 21cafe18eba551ddb970299fef40458b6e2adb40 (patch) | |
tree | c006d8aff5b530ad21614fce298736783c6c719b /res/controllers/midi-components-0.0.js | |
parent | 6e17ff8f70a0d8b34417419f945925e0374be883 (diff) |
midi-components: Fix undefined CO group on EffectUnit initialization
Before, the code caused a warning like this for each EffectUnit on
script load:
Warning [Controller]: ControlDoublePrivate::getControl returning NULL for ( "" , "controller_input_active" )
This was caused by PR #2322. The code tries to use the component's group
in `setCurrentUnit` even though it's not set until later in the code.
Diffstat (limited to 'res/controllers/midi-components-0.0.js')
-rw-r--r-- | res/controllers/midi-components-0.0.js | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index b00cb33db9..f6cd894099 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -818,21 +818,20 @@ 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); - } + if (Array.isArray(unitNumbers)) { + this.unitNumbers = unitNumbers; + } else if (typeof unitNumbers === "number" && + Math.floor(unitNumbers) === unitNumbers && + isFinite(unitNumbers)) { + this.unitNumbers = [unitNumbers]; } else { print("ERROR! new EffectUnit() called without specifying any unit numbers!"); return; } + this.group = "[EffectRack1_EffectUnit" + this.unitNumbers[0] + "]"; + this.setCurrentUnit(this.unitNumbers[0]); + this.dryWetKnob = new Pot({ group: this.group, unshift: function() { |