13
0

Tweak list-plugins script & add icon

This commit is contained in:
Robin Gareus 2020-08-01 01:15:57 +02:00
parent 7e5e9e46a1
commit 0c6d369434
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -5,7 +5,7 @@ ardour { ["type"] = "EditorAction", name = "List Plugins",
} }
function factory () return function () function factory () return function ()
local rv = "Plugins used in this session:\n<span face=\"mono\">CNT | TYPE | NAME</span>" local rv = "Plugins used in this session:\n\n"
local all_plugs = {} local all_plugs = {}
for r in Session:get_routes ():iter () do for r in Session:get_routes ():iter () do
@ -18,8 +18,10 @@ function factory () return function ()
local pp = pi:plugin (0) local pp = pi:plugin (0)
local id = pi:type() .. "-" .. pp:unique_id() local id = pi:type() .. "-" .. pp:unique_id()
local cnt = 0 local cnt = 0
if pi:is_channelstrip () then goto nextproc end
if all_plugs[id] then cnt = all_plugs[id]['cnt'] end if all_plugs[id] then cnt = all_plugs[id]['cnt'] end
all_plugs[id] = { name = proc:name(), ["type"] = pi:type(), id = pp:unique_id(), cnt = (cnt + 1) } all_plugs[id] = { name = proc:name(), ["type"] = pi:type(), id = pp:unique_id(), cnt = (cnt + 1) }
::nextproc::
i = i + 1 i = i + 1
end end
::nextroute:: ::nextroute::
@ -36,10 +38,34 @@ function factory () return function ()
return "??" return "??"
end end
for k,v in pairs (all_plugs) do if next(all_plugs) == nil then
print (string.format ("%2d * %-6s %-30s (%s)", v['cnt'], plugintypestr(v['type']), v['name'], v['id'])) rv = rv .. " -- NONE --"
rv = rv .. "\n" .. string.format ("%2d * %-6s %s", v['cnt'], plugintypestr(v['type']), v['name']) else
rv = rv .. "<span face=\"mono\">CNT | TYPE | NAME</span>"
end end
LuaDialog.Message ("All Plugins", "<span face=\"mono\">" .. rv .. "</span>", LuaDialog.MessageType.Info, LuaDialog.ButtonType.Close):run() for k,v in pairs (all_plugs) do
print (string.format ("%2d * %-6s %-30s (%s)", v['cnt'], plugintypestr(v['type']), v['name'], v['id']))
rv = rv .. "\n<span face=\"mono\">" .. string.format ("%3d * %-6s %s", v['cnt'], plugintypestr(v['type']), v['name']) .. "</span>"
end
LuaDialog.Message ("All Plugins",rv , LuaDialog.MessageType.Info, LuaDialog.ButtonType.Close):run()
end end
function icon (params) return function (ctx, width, height, fg)
local wh = math.min (width, height)
ctx:set_source_rgba (ARDOUR.LuaAPI.color_to_rgba (fg))
ctx:rectangle (wh * .2, wh * .35, wh * .4, wh * .3)
ctx:fill ()
ctx:rectangle (wh * .65, wh * .35, wh * .1, wh * .3)
ctx:fill ()
ctx:set_line_join (Cairo.LineJoin.Bevel)
ctx:set_line_width (.5)
ctx:move_to (wh * 0.85, wh * .35)
ctx:line_to (wh, wh * .5)
ctx:line_to (wh * 0.85, wh * .65)
ctx:close_path ()
ctx:fill_preserve ()
ctx:stroke ()
end end end end