Video-Frame (not sample)
[ardour.git] / scripts / s_chanmap.lua
1 ardour { ["type"] = "Snippet", name = "plugin channel-map dev" }
2
3 function factory () return function ()
4         -- first track needs to be stereo and have a stereo plugin
5         -- (x42-eq with spectrum display, per channel processing,
6         --  and pre/post visualization is very handy here)
7
8         function checksetup (r)
9                 -- fail if Route ID 1 is not present or not stereo
10                 assert (r and not r:isnil())
11                 assert (r:n_inputs():n_audio() == 2)
12                 -- check first Plugin and make sure it is a "Plugin Insert"
13                 if not r:nth_plugin(0):isnil() and not r:nth_plugin(0):to_insert():isnil() then return end
14                 -- insert x42-eq at the top.
15                 local proc = ARDOUR.LuaAPI.new_plugin(Session, "http://gareus.org/oss/lv2/fil4#stereo", ARDOUR.PluginType.LV2, "");
16                 r:add_processor_by_index(proc, 0, nil, true)
17         end
18
19         r = Session:get_remote_nth_route(1)
20         checksetup (r)
21         pi = r:nth_plugin(0):to_insert()
22
23         pi:set_no_inplace (true)
24
25         cm = ARDOUR.ChanMapping()
26         --cm:set(ARDOUR.DataType("Audio"), 0, 0)
27         cm:set(ARDOUR.DataType("Audio"), 1, 0)
28         pi:set_input_map (0, cm)
29
30         cm = ARDOUR.ChanMapping()
31         --cm:set(ARDOUR.DataType("Audio"), 0, 0)
32         cm:set(ARDOUR.DataType("Audio"), 1, 0)
33         pi:set_output_map (0, cm)
34 end end