13
0
livetrax/share/scripts/s_pluginutils.lua

58 lines
2.0 KiB
Lua
Raw Normal View History

2016-03-23 18:45:39 -04:00
ardour { ["type"] = "Snippet", name = "Plugin Utils" }
function factory () return function ()
-------------------------------------------------------------------------------
-- List all Plugins
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
for pset in psets:iter() do
print (" - ", pset.label)
end
end
end
2016-03-23 18:45:39 -04:00
-------------------------------------------------------------------------------
-- add a Plugin (here LV2) to all mono tracks that contain the pattern "dru"
-- and load a plugin-preset (if it exists)
for r in Session:get_routes():iter() do
if (string.match (r:name(), "dru") and r:n_inputs():n_audio() == 1) then
local proc = ARDOUR.LuaAPI.new_plugin(Session, "http://gareus.org/oss/lv2/fil4#mono", ARDOUR.PluginType.LV2, "cutbass");
2017-02-21 10:12:24 -05:00
assert (not proc:isnil())
2016-03-23 18:45:39 -04:00
r:add_processor_by_index(proc, 0, nil, true)
end
end
-------------------------------------------------------------------------------
-- load a plugin preset
route = Session:get_remote_nth_route(2)
2017-02-21 10:12:24 -05:00
assert (route)
2016-03-23 18:45:39 -04:00
-- to 4th plugin (from top), ardour starts counting at zero
plugin = route:nth_plugin(3):to_insert():plugin(0)
2017-02-21 10:12:24 -05:00
assert (not plugin:isnil())
2016-03-23 18:45:39 -04:00
ps = plugin:preset_by_label("cutbass") -- get preset by name
2017-02-21 10:12:24 -05:00
assert (ps)
2016-03-23 18:45:39 -04:00
print (ps.uri)
plugin:load_preset (ps)
-------------------------------------------------------------------------------
-- add a LuaProcessor (here "Scope") to all tracks
for t in Session:get_tracks():iter() do
local pos = 0 -- insert at the top
2017-02-21 10:12:24 -05:00
-- the following two lines are equivalent
--local proc = ARDOUR.LuaAPI.new_luaproc(Session, "ACE Inline Scope");
local proc = ARDOUR.LuaAPI.new_plugin (Session, "ACE Inline Scope", ARDOUR.PluginType.Lua, "");
2017-02-21 10:12:24 -05:00
assert (not proc:isnil())
2016-03-23 18:45:39 -04:00
t:add_processor_by_index(proc, pos, nil, true)
-- optionally set some parameters
ARDOUR.LuaAPI.set_processor_param (proc, 0, 5) -- timescale 5sec
end
end end