diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2020-02-11 09:49:42 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2020-02-11 09:49:42 +0000 |
| commit | d9ed2848c4709aa5f3757333dab0ec8de5833aef (patch) | |
| tree | 4d92c21b69170be9b14f74fd01cbf350b874a415 /lib/util.moon | |
| parent | envelopes (diff) | |
| download | alive-d9ed2848c4709aa5f3757333dab0ec8de5833aef.tar.gz alive-d9ed2848c4709aa5f3757333dab0ec8de5833aef.zip | |
add MIDI input ops
Diffstat (limited to 'lib/util.moon')
| -rw-r--r-- | lib/util.moon | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/util.moon b/lib/util.moon index 849466c..6da3698 100644 --- a/lib/util.moon +++ b/lib/util.moon @@ -1,4 +1,4 @@ -import Op from require 'core' +import Const, Op from require 'core' class switch_ extends Op @doc: "(switch i v0 [v1 v2...]) - switch between multiple inputs @@ -52,17 +52,18 @@ like (switch ...) except that the unused inputs are paused." active\get! class keep extends Op - @doc: "(keep value) - keep the last non-nil value + @doc: "(keep value [default]) - keep the last non-nil value -always reproduces the last non-nil value the input produced" +always reproduces the last non-nil value the input produced or default. +default defaults to zero." - setup: (@i) => + setup: (@i, @default=Const.num 0) => update: (dt) => @i\update dt next = @i\get! - @value = next or @value + @value = next or @value or @default\get! { 'switch': switch_ |
