diff options
author | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2019-11-14 16:34:02 +0100 |
---|---|---|
committer | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2020-02-29 17:48:40 +0100 |
commit | d803ea80c5b7d1a85bdd314ee4a9bcccb88444c5 (patch) | |
tree | 7ea791569b8bda1a4a6a58fb6d2d39f513fcb32c /res/controllers/midi-components-0.0.js | |
parent | a477c8747166bf6dc9e4e5142b60732592348a95 (diff) |
res/controllers/midi-components: Update HotcueButton to use new API
Diffstat (limited to 'res/controllers/midi-components-0.0.js')
-rw-r--r-- | res/controllers/midi-components-0.0.js | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index 7db8bd503b..caf0c52789 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -330,20 +330,16 @@ 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; - } + outputColor: function (colorCode) { + if (this.colors !== undefined) { + var nearestColor = color.nearestColorMidiCode(colorCode, this.colors); + this.send(nearestColor); + } else { 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); + this.sendRGB(color.colorFromHexCode(colorCode)); } }, connect: function() { |