summaryrefslogtreecommitdiff
path: root/dalos-buffer.lua
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2009-12-22 05:16:33 +0100
committerPixel <pixel@nobis-crew.org>2009-12-22 05:17:07 +0100
commit781be3edac2cd5e05df401f6eebb5b75660b99d0 (patch)
treeff070789fec854b2c997929b871b77bc1a2e2f09 /dalos-buffer.lua
parenta984dff9f2c8be16ad392e864c13de08fe729204 (diff)
Adding the 'Buffer' object.
Diffstat (limited to 'dalos-buffer.lua')
-rw-r--r--dalos-buffer.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/dalos-buffer.lua b/dalos-buffer.lua
new file mode 100644
index 0000000..ecab2ed
--- /dev/null
+++ b/dalos-buffer.lua
@@ -0,0 +1,30 @@
+dalosp.buffer = {
+ input_change = function (self, ind)
+ local h = self:get_linked_input(1)
+ if h then
+ self.color = cd.GREEN
+ local b = Buffer(true)
+ b:copyfrom(self:get_linked_input(1))
+ self:set_houtput(b)
+ else
+ self:set_houtput(nil)
+ self.color = cd.YELLOW
+ end
+ self.dcanvas:draw()
+ end,
+
+ create = function (d, tab, settings)
+ tab.ninputs = 1
+ tab.noutputs = 1
+ tab.otype = dalos.objtype.LUA_FILTER
+ tab.default_name = "Buffer"
+ tab.input_change = dalosp.buffer.input_change
+ tab.ntype = "Buffer"
+ local obj = dalos.object(d, tab, extra)
+
+ return obj
+ end,
+}
+
+dalos.buffer = dalosp.buffer.create
+dalos:register_obj("Buffer", dalos.buffer)