From 781be3edac2cd5e05df401f6eebb5b75660b99d0 Mon Sep 17 00:00:00 2001 From: Pixel Date: Tue, 22 Dec 2009 05:16:33 +0100 Subject: Adding the 'Buffer' object. --- dalos-buffer.lua | 30 ++++++++++++++++++++++++++++++ dalos.lua | 5 +++-- 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 dalos-buffer.lua 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" ---------------- -- cgit v1.2.3