From d041d89d07d1a62302db9ff5948a345447a82d23 Mon Sep 17 00:00:00 2001 From: cbdev Date: Sun, 22 Dec 2019 13:07:37 +0100 Subject: Add priority to sACN example config --- configs/launchctl-sacn.cfg | 1 + 1 file changed, 1 insertion(+) (limited to 'configs') diff --git a/configs/launchctl-sacn.cfg b/configs/launchctl-sacn.cfg index 0f4a19b..dedfc0f 100644 --- a/configs/launchctl-sacn.cfg +++ b/configs/launchctl-sacn.cfg @@ -14,6 +14,7 @@ read = Launch Control [sacn out] universe = 1 +priority = 100 [map] -- cgit v1.2.3 From 15b314d40692d4e86b5a030aab22e68c0f6aff51 Mon Sep 17 00:00:00 2001 From: cbdev Date: Mon, 23 Dec 2019 16:49:29 +0100 Subject: Multi-layering example configuration --- configs/layering.cfg | 18 ++++++++++++++ configs/layering.lua | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 configs/layering.cfg create mode 100644 configs/layering.lua (limited to 'configs') diff --git a/configs/layering.cfg b/configs/layering.cfg new file mode 100644 index 0000000..3acfe5e --- /dev/null +++ b/configs/layering.cfg @@ -0,0 +1,18 @@ +[backend artnet] +bind = 0.0.0.0 + +[midi in] +read = Launch Control + +[artnet out] +destination = 255.255.255.255 +universe = 1 + +[lua layers] +script = layering.lua + +[map] +in.ch0.cc{0..15} > layers.in{0..15} +layers.out{0..511} > out.{1..512} + +in.ch0.note0 > layers.control diff --git a/configs/layering.lua b/configs/layering.lua new file mode 100644 index 0000000..0ced715 --- /dev/null +++ b/configs/layering.lua @@ -0,0 +1,70 @@ +current_layer = 0 + +function control(value) + current_layer = math.floor(value * 31.99); +end + +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 -- cgit v1.2.3 From f4b448d304c22f7bf9c8b2675707d6924fbaba54 Mon Sep 17 00:00:00 2001 From: cbdev Date: Mon, 23 Dec 2019 17:56:38 +0100 Subject: Add some comments to the layering example --- configs/layering.cfg | 5 +++++ configs/layering.lua | 6 ++++++ 2 files changed, 11 insertions(+) (limited to 'configs') 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))) -- cgit v1.2.3 From 535181b25ccbc492f741b9eeb111a02dfd038b41 Mon Sep 17 00:00:00 2001 From: cbdev Date: Mon, 23 Dec 2019 20:22:14 +0100 Subject: Fix lua order of operations --- configs/layering.lua | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'configs') diff --git a/configs/layering.lua b/configs/layering.lua index 834ed09..5d9458d 100644 --- a/configs/layering.lua +++ b/configs/layering.lua @@ -12,65 +12,65 @@ end -- 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))) + print("Output on out"..(current_layer * 16)) end function in1(value) - output("out"..((current_layer * 16)) + 1, value) + output("out"..((current_layer * 16) + 1), value) end function in2(value) - output("out"..((current_layer * 16)) + 2, value) + output("out"..((current_layer * 16) + 2), value) end function in3(value) - output("out"..((current_layer * 16)) + 3, value) + output("out"..((current_layer * 16) + 3), value) end function in4(value) - output("out"..((current_layer * 16)) + 4, value) + output("out"..((current_layer * 16) + 4), value) end function in5(value) - output("out"..((current_layer * 16)) + 5, value) + output("out"..((current_layer * 16) + 5), value) end function in6(value) - output("out"..((current_layer * 16)) + 6, value) + output("out"..((current_layer * 16) + 6), value) end function in7(value) - output("out"..((current_layer * 16)) + 7, value) + output("out"..((current_layer * 16) + 7), value) end function in8(value) - output("out"..((current_layer * 16)) + 8, value) + output("out"..((current_layer * 16) + 8), value) end function in9(value) - output("out"..((current_layer * 16)) + 9, value) + output("out"..((current_layer * 16) + 9), value) end function in10(value) - output("out"..((current_layer * 16)) + 10, value) + output("out"..((current_layer * 16) + 10), value) end function in11(value) - output("out"..((current_layer * 16)) + 11, value) + output("out"..((current_layer * 16) + 11), value) end function in12(value) - output("out"..((current_layer * 16)) + 12, value) + output("out"..((current_layer * 16) + 12), value) end function in13(value) - output("out"..((current_layer * 16)) + 13, value) + output("out"..((current_layer * 16) + 13), value) end function in14(value) - output("out"..((current_layer * 16)) + 14, value) + output("out"..((current_layer * 16) + 14), value) end function in15(value) - output("out"..((current_layer * 16)) + 15, value) + output("out"..((current_layer * 16) + 15), value) end -- cgit v1.2.3