aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2019-12-23 17:56:38 +0100
committercbdev <cb@cbcdn.com>2019-12-23 17:56:38 +0100
commitf4b448d304c22f7bf9c8b2675707d6924fbaba54 (patch)
tree90845cb59ed9c354350858dc29e86826333eeae1
parent15b314d40692d4e86b5a030aab22e68c0f6aff51 (diff)
downloadmidimonster-f4b448d304c22f7bf9c8b2675707d6924fbaba54.tar.gz
midimonster-f4b448d304c22f7bf9c8b2675707d6924fbaba54.tar.bz2
midimonster-f4b448d304c22f7bf9c8b2675707d6924fbaba54.zip
Add some comments to the layering example
-rw-r--r--configs/layering.cfg5
-rw-r--r--configs/layering.lua6
2 files changed, 11 insertions, 0 deletions
diff --git a/configs/layering.cfg b/configs/layering.cfg
index 3acfe5e..7adcd6f 100644
--- a/configs/layering.cfg
+++ b/configs/layering.cfg
@@ -1,3 +1,8 @@
+; This configuration demonstrates how to create a "layered" mapping
+; using the Lua backend. The 'control' channel on the layers instance
+; selects the offset to which the 16 input channels (mapped from
+; the rotaries of a Launch Control) are mapped on the output instance
+
[backend artnet]
bind = 0.0.0.0
diff --git a/configs/layering.lua b/configs/layering.lua
index 0ced715..834ed09 100644
--- a/configs/layering.lua
+++ b/configs/layering.lua
@@ -1,9 +1,15 @@
+-- This global variable has the current base offset for the input channels.
+-- We want to map 16 input channels (from MIDI) to 512 output channels (ArtNet),
+-- so we have 32 possible offsets (32 * 16 = 512)
current_layer = 0
+-- Set the current_layer based on the control input channel
function control(value)
current_layer = math.floor(value * 31.99);
end
+-- Handler functions for the input channels
+-- Calculate the channel offset and just output the value the input channel provides
function in0(value)
output("out"..((current_layer * 16)), value)
print("Output on out"..((current_layer * 16)))