diff options
Diffstat (limited to 'lib/pilot.moon')
| -rw-r--r-- | lib/pilot.moon | 90 |
1 files changed, 51 insertions, 39 deletions
diff --git a/lib/pilot.moon b/lib/pilot.moon index a687e48..b851440 100644 --- a/lib/pilot.moon +++ b/lib/pilot.moon @@ -1,4 +1,4 @@ -import Op, Input, Error, match from require 'core.base' +import Op, Value, Input, Error, match from require 'core.base' import udp from require 'socket' local conn @@ -20,53 +20,65 @@ send = (...) -> conn or= udp! conn\sendto str, '127.0.0.1', 49161 -class play extends Op - @doc: "(play trig ch oct note [vel [len]]) - play a note when trig is live" +play = Value.meta + meta: + name: 'play' + summary: "Play a note when a bang arrives." + examples: { '(pilot/play trig ch oct note [vel [len]])' } - setup: (inputs) => - { trig, args } = match 'bang *any', inputs - assert #args < 6, Error 'argument', "too many arguments!" - super - trig: Input.event trig - args: [Input.cold a for a in *args] + value: class extends Op + setup: (inputs) => + { trig, args } = match 'bang *any', inputs + assert #args < 6, Error 'argument', "too many arguments!" + super + trig: Input.event trig + args: [Input.cold a for a in *args] - tick: => - { :trig, :args } = @inputs - if trig\dirty! and trig! - send [a! for a in *@inputs.args] + tick: => + { :trig, :args } = @inputs + if trig\dirty! and trig! + send [a! for a in *@inputs.args] -class play_ extends Op - @doc: "(play! ch oct note [vel [len]]) - play a note when note is live" +play_ = Value.meta + meta: + name: 'play!' + summary: "Play a note when a note arrives." + examples: { '(pilot/play! ch oct note [vel [len]])' } - setup: (inputs) => - { chan, octv, note, args } = match 'any any any *any', inputs - assert #args < 3, Error 'argument', "too many arguments!" - super - chan: Input.cold chan - octv: Input.cold octv - note: Input.event note - args: [Input.cold a for a in *args] + value: class extends Op + setup: (inputs) => + { chan, octv, note, args } = match 'any any any *any', inputs + assert #args < 3, Error 'argument', "too many arguments!" + super + chan: Input.cold chan + octv: Input.cold octv + note: Input.event note + args: [Input.cold a for a in *args] - tick: => - if @inputs.note\dirty! - { :chan, :oct, :note, :args } = @unwrap_all! - send { chan, oct, note }, args + tick: => + if @inputs.note\dirty! + { :chan, :oct, :note, :args } = @unwrap_all! + send { chan, oct, note }, args -class effect extends Op - @doc: "(effect which a b) - set an effect +effect = Value.meta + meta: + name: 'effect' + summary: "Set effect parameters." + examples: { '(pilot/effect which a b)' } + description: "`effect` should be one of 'DIS', 'CHO', 'REV' or 'FEE'" -which is one of 'DIS', 'CHO', 'REV' or 'FEE'" + value: class extends Op + setup: (inputs) => + { which, a, b } = match 'str num num', inputs + super { + Input.cold which + Input.value a + Input.value b + } - setup: (inputs) => - { which, a, b } = match 'str num num', inputs - super { - Input.cold which - Input.value a - Input.value b - } + tick: => + send @unwrap_all! - tick: => - send @unwrap_all! { :play 'play!': play_ |
