aboutsummaryrefslogtreecommitdiffstats
path: root/lib/pilot.moon
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pilot.moon')
-rw-r--r--lib/pilot.moon22
1 files changed, 7 insertions, 15 deletions
diff --git a/lib/pilot.moon b/lib/pilot.moon
index 1cbc070..2a7d21a 100644
--- a/lib/pilot.moon
+++ b/lib/pilot.moon
@@ -1,5 +1,5 @@
-import Const, Op, FnDef from require 'core'
-import dns, udp from require 'socket'
+import Op from require 'core'
+import udp from require 'socket'
conn = udp!
hex = "0123456789abcdef"
@@ -18,17 +18,12 @@ send = (tbl) ->
class play extends Op
@doc: "(play trig ch oct note [vel [len]]) - play a note when trig is live"
- setup: (@trig, @ch, @oct, @note, @vel, @len) =>
+ setup: (@trig, ...) =>
+ @vals = { ... }
update: (dt) =>
- vals = for c in *{@trig, @ch, @oct, @note, @vel, @len }
- c\update dt
- c\get!
-
- trig = table.remove vals, 1
-
- if trig
- send vals
+ if @trig\unwrap 'bool'
+ send [c\unwrap! for c in *@vals]
class effect extends Op
@doc: "(effect which a b) - set an effect
@@ -38,10 +33,7 @@ which is one of 'DIS', 'CHO', 'REV' or 'FEE'"
setup: (@which, @a, @b) =>
update: (dt) =>
- @which\update dt
- @a\update dt
- @b\update dt
- which, a, b = @which\get!, @a\get!, @b\get!
+ which, a, b = (@which\unwrap 'str'), @a\unwrap!, @b\unwrap!
if which and a and b
send { which, a, b }
{