summaryrefslogtreecommitdiffstats
path: root/res/controllers/midi-components-0.0.js
diff options
context:
space:
mode:
authorJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2020-03-11 10:54:04 +0100
committerJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2020-03-11 10:54:04 +0100
commitf50ccbe0a07198b50d34427e0b6389e889eccc89 (patch)
tree6e9e591d04c8814ade4a10e634a30582f2846eea /res/controllers/midi-components-0.0.js
parent2f95d2d61497ccfd448bc0f7aab6b429ff56a728 (diff)
res/controllers/midi-components-0.0.js: Add some more comments
Diffstat (limited to 'res/controllers/midi-components-0.0.js')
-rw-r--r--res/controllers/midi-components-0.0.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js
index 63f1154d29..5ba3e0e53a 100644
--- a/res/controllers/midi-components-0.0.js
+++ b/res/controllers/midi-components-0.0.js
@@ -321,15 +321,24 @@
}
},
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) {
print("Ignoring invalid color code 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. The user needs to specify a sendRGB()
+ // function, because the procedure is controller-dependent.
if (this.sendRGB === undefined) {
throw Error("sendRGB(color) not defined - unable to send RGB colors!");
}