andr-ew / nest_

a language of touch for objects by monome [not maintained]
MIT License
21 stars 3 forks source link

add affordance:link #79

Closed andr-ew closed 3 years ago

andr-ew commented 3 years ago

a shortcut function with an internal table of callbacks that can populate an affordance from an existing param based on the types of each. control -> control for example might look like this:

function(o, id)
    o:merge {
        label = id,
        controlspec = params:lookup_param(id).controlspec,
        value = function() return params:get(id) end,
        action = function(s, v) params:set(id, v) end
    }
end

caveat is that params you want to midi map (probably the only reason to use this feature) need to call redraw to update what's shown on the screen

TODO:

andr-ew commented 3 years ago

option -> option

o:merge {
    options = params:lookup_param(id).options,
    value = function() return params:get(id) end,
    action = function(s, v) params:set(id, v) end
}
andr-ew commented 3 years ago

I should rethink how exactly this works in the presence of functionality that links stuff to crow's new public system as well ! (separate functions vs. additional options in this function) { ... } :param('id') { ... } :public('id')

{ ... } :link(params, 'id') { ... } :link(public, 'id')

{ ... } :link('params/id') { ... } :link('public/id')

andr-ew commented 3 years ago

yea, I think splitting up the functions is most clear :param() :public() :macro()