aboutsummaryrefslogtreecommitdiffhomepage
path: root/configs
diff options
context:
space:
mode:
Diffstat (limited to 'configs')
-rw-r--r--configs/demo.lua45
-rw-r--r--configs/lua.cfg10
2 files changed, 40 insertions, 15 deletions
diff --git a/configs/demo.lua b/configs/demo.lua
index e816ac4..24a8396 100644
--- a/configs/demo.lua
+++ b/configs/demo.lua
@@ -1,21 +1,42 @@
--- This example MIDIMonstaer Lua script spreads one input channel onto multiple output
+-- This example MIDIMonster Lua script spreads one input channel onto multiple output
-- channels using a polynomial function evaluated at multiple points. This effect can
-- be visualized e.g. with martrix (https://github.com/cbdevnet/martrix).
--- This is just a demonstration of global variables
-foo = 0
-
-- The polynomial to evaluate
-function polynomial(offset, x)
- return math.exp(-20 * (x - offset) ^ 2)
+function polynomial(x)
+ return math.exp(-40 * input_value("width") * (x - input_value("offset")) ^ 2)
end
--- Handler function for the input channel
-function input(value)
- foo = foo + 1
- print("input at ", value, foo)
-
+-- Evaluate and set output channels
+function evaluate()
for chan=0,10 do
- output("out" .. chan, polynomial(value, (1 / 10) * chan))
+ output("out" .. chan, polynomial((1 / 10) * chan))
+ end
+end
+
+-- Handler functions for the input channels
+function offset(value)
+ evaluate()
+end
+
+function width(value)
+ evaluate()
+end
+
+-- This is an example showing a simple chase running on its own without the need
+-- (but the possibility) for external input
+
+-- Global value for the current step
+current_step = 0
+
+function step()
+ if(current_step > 0) then
+ output("dim", 0.0)
+ else
+ output("dim", 1.0)
end
+
+ current_step = (current_step + 1) % 2
end
+
+interval(step, 1000)
diff --git a/configs/lua.cfg b/configs/lua.cfg
index 9182122..42fd27d 100644
--- a/configs/lua.cfg
+++ b/configs/lua.cfg
@@ -8,8 +8,9 @@ bind = 0.0.0.0
device = /dev/input/by-path/platform-i8042-serio-2-event-mouse
[evdev xbox]
-input = Xbox Wireless
+device = /dev/input/event17
axis.ABS_X = 34300 0 65535 255 4095
+axis.ABS_Y = 34300 0 65535 255 4095
[lua lua]
script = configs/demo.lua
@@ -19,8 +20,9 @@ universe = 0
destination = 255.255.255.255
[map]
-mouse.EV_KEY.BTN_LEFT > lua.input
-xbox.EV_ABS.ABS_X > lua.input
+mouse.EV_KEY.BTN_LEFT > lua.click
+xbox.EV_ABS.ABS_X > lua.offset
+xbox.EV_ABS.ABS_Y > lua.width
art.1 < lua.out0
art.2 < lua.out1
@@ -33,3 +35,5 @@ art.8 < lua.out7
art.9 < lua.out8
art.10 < lua.out9
art.11 < lua.out10
+
+art.12 < lua.dim