diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2020-02-16 11:47:24 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2020-02-16 11:47:24 +0000 |
| commit | 2953f1e56b408fc26eb54fa65935505dd128ce82 (patch) | |
| tree | 8c7c513ccf03df06c4e9e2e70ba68031d2d0b7a5 /lib/pilot.moon | |
| parent | add ==, mod (diff) | |
| download | alive-2953f1e56b408fc26eb54fa65935505dd128ce82.tar.gz alive-2953f1e56b408fc26eb54fa65935505dd128ce82.zip | |
major refactoring: Const, Stream + ResultNode
Diffstat (limited to 'lib/pilot.moon')
| -rw-r--r-- | lib/pilot.moon | 22 |
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 } { |
