1 -------------------------------------------------------------------------------
2 -- collection of snippets for testing and upcoming doc
3 -------------------------------------------------------------------------------
6 -------------------------------------------------------------------------------
8 route = Session:route_by_remote_id(1)
9 old = route:nth_plugin(0)
10 new = ARDOUR.LuaAPI.new_plugin(Session, "http://gareus.org/oss/lv2/fil4#stereo", ARDOUR.PluginType.LV2, "");
11 route:replace_processor (old, new, nil)
12 old = nil new = nil -- explicitly drop references (unless they're local vars)
15 -------------------------------------------------------------------------------
16 -- add a LuaProcessor (here "Scope") to all tracks
17 for t in Session:get_tracks():iter() do
18 local pos = 0 -- insert at the top
19 local proc = ARDOUR.LuaAPI.new_luaproc(Session, "Inline Scope");
20 t:add_processor_by_index(proc, pos, nil, true)
21 -- optionally set some parameters
22 ARDOUR.LuaAPI.set_processor_param (proc, 0, 5) -- timescale 5sec
25 -------------------------------------------------------------------------------
26 -- add a Plugin (here LV2) to all mono tracks that contain the pattern "dru"
27 -- and load a plugin-preset (if it exists)
28 for r in Session:get_routes():iter() do
29 if (string.match (r:name(), "dru") and r:n_inputs():n_audio() == 1) then
30 local proc = ARDOUR.LuaAPI.new_plugin(Session, "http://gareus.org/oss/lv2/fil4#mono", ARDOUR.PluginType.LV2, "cutbass");
31 r:add_processor_by_index(proc, 0, nil, true)
35 -------------------------------------------------------------------------------
36 -- load a plugin preset
37 route = Session:route_by_remote_id(2)
38 -- to 4th plugin (from top), ardour starts counting at zero
39 plugin = route:nth_plugin(3):to_insert():plugin(0)
40 ps = plugin:preset_by_label("cutbass") -- get preset by name
42 plugin:load_preset (ps)