X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=scripts%2Fremove_unknown_procs.lua;h=044e85b3b8af65348a24c626d8f6577b39fb4cc4;hb=54aa82cd4be12e48580c3e6bc17a580b8fd86d0c;hp=6fb857edfe11d7317ccf2c219dbea472c7bcd5de;hpb=491d183c78213b030d5d204bcf4c84de9f9a3d25;p=ardour.git diff --git a/scripts/remove_unknown_procs.lua b/scripts/remove_unknown_procs.lua index 6fb857edfe..044e85b3b8 100644 --- a/scripts/remove_unknown_procs.lua +++ b/scripts/remove_unknown_procs.lua @@ -1,21 +1,44 @@ ardour { ["type"] = "EditorAction", name = "Remove Unknown Plugins", license = "MIT", - author = "Robin Gareus", - email = "robin@gareus.org", - site = "http://gareus.org", + author = "Ardour Team", description = [[Remove all unknown plugins/processors from all tracks and busses]] } function factory (params) return function () + -- iterate over all tracks and busses (aka routes) for route in Session:get_routes ():iter () do + -- route is-a http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Route local i = 0; + -- we need to iterate one-by one, removing a processor invalidates the list repeat proc = route:nth_processor (i) + -- proc is a http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Processor + -- try cast it to http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:UnknownProcessor if not proc:isnil () and not proc:to_unknownprocessor ():isnil () then route:remove_processor (proc, nil, true) else i = i + 1 end - until proc:isnil() + until proc:isnil () end end end + + +function icon (params) return function (ctx, width, height, fg) + local txt = Cairo.PangoLayout (ctx, "ArdourMono ".. math.ceil (math.min (width, height) * .5) .. "px") + txt:set_text ("Fx") + local tw, th = txt:get_pixel_size () + ctx:move_to (.5 * (width - tw), .5 * (height - th)) + txt:layout_cairo_path (ctx) + + ctx:set_source_rgba (ARDOUR.LuaAPI.color_to_rgba (fg)) + ctx:set_line_width (3) + ctx:stroke_preserve () + + ctx:set_source_rgba (.8, .2, .2, 1) + ctx:set_line_width (2) + ctx:stroke_preserve () + + ctx:set_source_rgba (0, 0, 0, 1) + ctx:fill () +end end