summaryrefslogtreecommitdiff
path: root/dalos-buffer.lua
blob: ecab2ed87576467b216f5d87f021f2dbb2b10543 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)