summaryrefslogtreecommitdiff
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
parenta984dff9f2c8be16ad392e864c13de08fe729204 (diff)
Adding the 'Buffer' object.
-rw-r--r--dalos-buffer.lua30
-rw-r--r--dalos.lua5
2 files changed, 33 insertions, 2 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)
diff --git a/dalos.lua b/dalos.lua
index 399fff3..deea0fa 100644
--- a/dalos.lua
+++ b/dalos.lua
@@ -18,11 +18,11 @@ dalosp.cross = { }
dalos.version = { MAJOR = 0, MINOR = 1, suffix = "alpha" }
-function dalos:register_obj(name, constructor)
+function dalos:register_obj(name, constructor, category)
if self.objectstypes_by_name[name] then
error("An object type of that name already exists: " .. name)
end
- table.insert(self.objectstypes, { name = name, constructor = constructor, counter = 1 })
+ table.insert(self.objectstypes, { name = name, constructor = constructor, counter = 1, category = category or "Basic" })
self.objectstypes_by_name[name] = #self.objectstypes
if self.activemenu then
self.activemenu:update_objects()
@@ -816,6 +816,7 @@ load "dalos-limiter.lua"
load "dalos-textbuffer.lua"
load "dalos-input.lua"
load "dalos-tee.lua"
+load "dalos-buffer.lua"
----------------