Add Lua binding to query plugin-presets and scalepoints

This commit is contained in:
Robin Gareus 2021-05-27 16:54:48 +02:00
parent 270b043e8f
commit e91fd1fce6
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
4 changed files with 56 additions and 8 deletions

View file

@ -7,7 +7,7 @@ function factory () return function ()
for p in ARDOUR.LuaAPI.list_plugins():iter() do
print (p.name, p.unique_id, p.type)
local psets = p:get_presets()
if not empty:empty() then
if not psets:empty() then
for pset in psets:iter() do
print (" - ", pset.label)
end
@ -25,19 +25,36 @@ function factory () return function ()
end
end
-------------------------------------------------------------------------------
-- load a plugin preset
route = Session:get_remote_nth_route(2)
local route = Session:get_remote_nth_route(2)
assert (route)
-- to 4th plugin (from top), ardour starts counting at zero
plugin = route:nth_plugin(3):to_insert():plugin(0)
local plugin = route:nth_plugin(3):to_insert():plugin(0)
assert (not plugin:isnil())
ps = plugin:preset_by_label("cutbass") -- get preset by name
assert (ps)
print (ps.uri)
plugin:load_preset (ps)
local ps = plugin:preset_by_label("cutbass") -- get preset by name
if ps and ps.valid then
print (ps.uri)
plugin:load_preset (ps)
end
-- query preset
local lp = plugin:last_preset ()
print ("valid?", lp.valid, "Preset ID:", lp.uri, "Preset Name:", lp.label, "User Preset (not factory):", lp.user)
-- list preset of given plugin
if not psets:empty() then
for pset in psets:iter() do
print (" - ", pset.label, pset.uri)
end
end
-- print scale-points of a given plugin-parameter
local _, pd = plugin:get_parameter_descriptor (3, ARDOUR.ParameterDescriptor())
local sp = ARDOUR.LuaAPI.desc_scale_points (pd[2]);
for k, v in pairs(sp) do
print (k, v)
end
-------------------------------------------------------------------------------
-- add a LuaProcessor (here "Scope") to all tracks