diff options
-rw-r--r-- | dalos-buffer.lua | 30 | ||||
-rw-r--r-- | dalos.lua | 5 |
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)
@@ -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" ---------------- |