aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSpacelord <Spacelord09@users.noreply.github.com>2020-04-26 02:28:11 +0200
committerSpacelord <Spacelord09@users.noreply.github.com>2020-04-26 02:28:11 +0200
commit7693ed34ab5e549b8b7fb8ca395bbf15616d6915 (patch)
treeb9eae78f6d04dc04ceb3d148a087300d5b8070f3
parent3691faaaf6da4d479c31b0246949be2f4a02b8b5 (diff)
downloadmidimonster-7693ed34ab5e549b8b7fb8ca395bbf15616d6915.tar.gz
midimonster-7693ed34ab5e549b8b7fb8ca395bbf15616d6915.tar.bz2
midimonster-7693ed34ab5e549b8b7fb8ca395bbf15616d6915.zip
Update layering config to use the new default-handler functionality
-rw-r--r--configs/layering.cfg5
-rw-r--r--configs/layering.lua82
2 files changed, 14 insertions, 73 deletions
diff --git a/configs/layering.cfg b/configs/layering.cfg
index 7adcd6f..b71f9e5 100644
--- a/configs/layering.cfg
+++ b/configs/layering.cfg
@@ -7,7 +7,7 @@
bind = 0.0.0.0
[midi in]
-read = Launch Control
+read = BCF
[artnet out]
destination = 255.255.255.255
@@ -15,9 +15,10 @@ universe = 1
[lua layers]
script = layering.lua
+default-handler = handler
[map]
-in.ch0.cc{0..15} > layers.in{0..15}
+in.ch1.cc{1..8} > layers.in{0..7}
layers.out{0..511} > out.{1..512}
in.ch0.note0 > layers.control
diff --git a/configs/layering.lua b/configs/layering.lua
index 5d9458d..5ddde65 100644
--- a/configs/layering.lua
+++ b/configs/layering.lua
@@ -3,74 +3,14 @@
-- 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))
-end
-
-function in1(value)
- output("out"..((current_layer * 16) + 1), value)
-end
-
-function in2(value)
- output("out"..((current_layer * 16) + 2), value)
-end
-
-function in3(value)
- output("out"..((current_layer * 16) + 3), value)
-end
-
-function in4(value)
- output("out"..((current_layer * 16) + 4), value)
-end
-
-function in5(value)
- output("out"..((current_layer * 16) + 5), value)
-end
-
-function in6(value)
- output("out"..((current_layer * 16) + 6), value)
-end
-
-function in7(value)
- output("out"..((current_layer * 16) + 7), value)
-end
-
-function in8(value)
- output("out"..((current_layer * 16) + 8), value)
-end
-
-function in9(value)
- output("out"..((current_layer * 16) + 9), value)
-end
-
-function in10(value)
- output("out"..((current_layer * 16) + 10), value)
-end
-
-function in11(value)
- output("out"..((current_layer * 16) + 11), value)
-end
-
-function in12(value)
- output("out"..((current_layer * 16) + 12), value)
-end
-
-function in13(value)
- output("out"..((current_layer * 16) + 13), value)
-end
-
-function in14(value)
- output("out"..((current_layer * 16) + 14), value)
-end
-
-function in15(value)
- output("out"..((current_layer * 16) + 15), value)
-end
+function handler(value)
+ if(input_channel() == "control") then
+ -- Set the current_layer based on the control input channel
+ current_layer = math.floor(value * 31.99);
+ else
+ -- Handler functions for the input channels
+ -- Calculate the channel offset and just output the value the input channel provides
+ output("out"..((current_layer * 16) + tonumber(input_channel())), value)
+ print("Output on out"..(current_layer * 16))
+ end
+end \ No newline at end of file