summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2009-12-21 23:40:31 +0100
committerPixel <pixel@nobis-crew.org>2009-12-22 00:18:33 +0100
commit5d600b135fee0fd3f2ccbc9ee37ffd4e37cad7ac (patch)
treec4349f3a8c65ef5e520fabc7fc6d7cd8e5f00094
parent08dc3021d7769d60131668ff98166a4280eec1da (diff)
Adding the Tee object.
-rw-r--r--dalos-tee.lua50
-rw-r--r--dalos.lua1
2 files changed, 51 insertions, 0 deletions
diff --git a/dalos-tee.lua b/dalos-tee.lua
new file mode 100644
index 0000000..5c9b26a
--- /dev/null
+++ b/dalos-tee.lua
@@ -0,0 +1,50 @@
+dalosp.tee = {
+ NTEE = 16,
+
+ set_out = function (self, h, ind)
+ local name = h:getname()
+ local obj = {
+ h = h,
+ size = h:getsize(),
+ getname = function () return name end,
+ do_read = function (self, count, userdata)
+ self.h:seek(self.offset, SEEK_SET)
+ return self.h:read(count, userdata)
+ end,
+ }
+ self:set_houtput(dalos.luahandle(obj), ind)
+ end,
+
+ input_change = function (self, ind)
+ local h = self:get_linked_input(1)
+ if h then
+ self.color = cd.GREEN
+ for ind = 1, 16 do self:set_out(h, ind) end
+ self.dcanvas:draw()
+ else
+ self.color = cd.YELLOW
+ for i = 1, dalosp.tee.NTEE do
+ self:set_houtput(nil, i)
+ end
+ self.dcanvas:draw()
+ end
+ end,
+
+ create = function (d, tab, settings)
+ tab.ninputs = 1
+ tab.noutputs = dalosp.tee.NTEE
+ tab.otype = dalos.objtype.LUA_FILTER
+ tab.input_change = dalosp.tee.input_change
+ tab.default_name = "Tee"
+ tab.ntype = "Tee"
+
+ local obj = dalos.object(d, tab)
+
+ obj.set_out = dalosp.tee.set_out
+
+ return obj
+ end,
+}
+
+dalos.tee = dalosp.tee.create
+dalos:register_obj("Tee", dalos.tee)
diff --git a/dalos.lua b/dalos.lua
index 3b53b72..32a8bca 100644
--- a/dalos.lua
+++ b/dalos.lua
@@ -813,6 +813,7 @@ load "dalos-binaryops.lua"
load "dalos-limiter.lua"
load "dalos-textbuffer.lua"
load "dalos-input.lua"
+load "dalos-tee.lua"
----------------