2 ["type"] = "EditorAction",
5 author = "Ardour Team",
6 description = [[Add 'Inline Scope' Lua Processor to all Tracks]]
9 function action_params ()
12 ["unique"] = { title = "Only add Scope if non is present already (yes/no)", default = "yes"},
13 ["position"] = { title = "Insert Position from top (0,..)", default = "0"},
18 function factory (params)
21 local p = params or {}
22 local uniq = p["unique"] or "yes"
23 local pos = p["position"] or 0
25 -- loop over all tracks
26 for t in Session:get_tracks():iter() do
29 -- check if a scope is already present
34 -- get Nth Ardour::Processor
35 proc = t:nth_plugin (i)
36 -- check if it's a scope
37 if (not proc:isnil() and proc:display_name () == "a-Inline Scope") then
41 until proc:isnil() or insert == false
44 -- create a new processor and insert it
46 local a = ARDOUR.LuaAPI.new_luaproc(Session, "a-Inline Scope");
47 if (not a:isnil()) then
48 t:add_processor_by_index(a, pos, nil, true)
49 ARDOUR.LuaAPI.set_processor_param (a, 0, 5) -- timescale 5sec
50 -- ARDOUR.LuaAPI.set_processor_param (a, 1, 1) -- logscale on
51 -- ARDOUR.LuaAPI.set_processor_param (a, 2, 3) -- "Max" height
52 a = nil -- explicitly drop shared-ptr reference
60 function icon (params) return function (ctx, width, height)
61 local wh = math.min (width, height) * .5
62 local x0 = math.ceil (wh * .4)
63 local x1 = math.floor (wh * 1.6)
64 ctx:rectangle (wh * .4, wh * .4, wh * 1.2, wh * 1.2)
65 ctx:set_source_rgba (.7, .7, .7, 1)
67 ctx:set_line_width (1)
68 ctx:set_source_rgba (.0, .0, .0, 1)
71 ctx:line_to (x, wh - math.sin (2 * math.pi * (x-x0) / (x1-x0)) * wh * .5)