@ppqq prompted a little investigation into meta-parameters (and i think i recall seeing @carvingcode exploring this earlier?)
basic goal: have a parameter which is the assignment for another parameter.
ie: a parameter which maps the destination of an encoder turn.
here’s some existing code from earthsea, sound params (without set_action for each)
params:add_control("shape", "shape", controlspec.new(0,1,"lin",0,0,""))
params:add_control("timbre", "timbre", controlspec.new(0,1,"lin",0,0.5,""))
params:add_control("noise", "noise", controlspec.new(0,1,"lin",0,0,""))
params:add_control("cut", "cut", controlspec.new(0,32,"lin",0,8,""))
add a meta param:
params:add_option("enc2","enc 2 mapping", {"shape","timbre","noise","cut"})
then let’s implement the mapping:
function enc(n,delta)
if n==2 then
params:delta(params:string("enc2"),delta*4)
end
end
calling params:string returns the string name from the OPTION, which sets the destination of the delta change. i multiply by 4 to increase sensitivity.
so now encoder turns can be redirected very easily in PLAY mode.
and you could of course have a key action rotate/change the OPTION as well