aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2020-03-02 18:00:54 +0000
committers-ol <s-ol@users.noreply.github.com>2020-03-02 18:00:54 +0000
commit79d483435a70c47c1711b3876d66077b4f1041d2 (patch)
treed19181a435bdf3e5ba374c67501df29da2d59d2c /lib
parentonly :tick after :setup if dirty (diff)
downloadalive-79d483435a70c47c1711b3876d66077b4f1041d2.tar.gz
alive-79d483435a70c47c1711b3876d66077b4f1041d2.zip
find IO via Result tree, not Registry
Diffstat (limited to 'lib')
-rw-r--r--lib/midi/core.moon8
-rw-r--r--lib/time.moon14
2 files changed, 5 insertions, 17 deletions
diff --git a/lib/midi/core.moon b/lib/midi/core.moon
index d91fdcb..156feb2 100644
--- a/lib/midi/core.moon
+++ b/lib/midi/core.moon
@@ -57,17 +57,11 @@ class MidiPort extends IO
class PortOp extends Op
new: => super 'midi/port'
- destroy: =>
- Registry.active!\remove_io @port if @port
-
tick: (inp, out) =>
if (inp and inp\dirty!) or (out and out\dirty!)
- Registry.active!\remove_io @port if @port
inp = inp and find_port RtMidiIn, inp!
out = out and find_port RtMidiOut, out!
- @port = MidiPort inp, out
- Registry.active!\add_io @port
- @out\set @port
+ @out\set MidiPort inp, out
class input extends PortOp
@doc: "(midi/input name) - create a MIDI input port"
diff --git a/lib/time.moon b/lib/time.moon
index f93258a..d44013e 100644
--- a/lib/time.moon
+++ b/lib/time.moon
@@ -31,15 +31,9 @@ fps defaults to 60 and has to be an eval-time constant"
{ fps } = match 'num?', inputs
super fps: ValueInput fps or Value.num 60
- destroy: =>
- Registry.active!\remove_io @clock if @clock
-
tick: =>
if @inputs.fps\dirty!
- Registry.active!\remove_io @clock if @clock
- @clock = Clock 1 / @inputs.fps!
- Registry.active!\add_io @clock
- @out\set @clock
+ @out\set Clock 1 / @inputs.fps!
class lfo extends Op
@doc: "(lfo [clock] freq [wave]) - low-frequency oscillator
@@ -97,7 +91,7 @@ ramps from 0 to max (default same as ramp) once every period seconds."
max or= period
@phase += clock.dt / period
- if @phase >= 1
+ while @phase >= 1
@phase -= 1
if clock_dirty or (@inputs.max and @inputs.max\dirty!)
@@ -122,7 +116,7 @@ counts upwards by one every period seconds and returns the number of completed t
{ :clock, :period, :max } = @unwrap_all!
@phase += clock.dt / period
- if @phase >= 1
+ while @phase >= 1
@phase -= 1
@count += 1
@out\set @count
@@ -146,7 +140,7 @@ returns true once every period seconds."
{ :clock, :period, :max } = @unwrap_all!
@phase += clock.dt / period
- if @phase >= 1
+ while @phase >= 1
@phase -= 1
@out\set true