summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorBen Loftis <ben@harrisonconsoles.com>2016-12-05 12:20:42 -0600
committerBen Loftis <ben@harrisonconsoles.com>2016-12-06 15:34:08 -0600
commitfb257f1ed17bb5239793cbe81503a32366a92b5c (patch)
tree9ee2637e2317d145661e8d16e76a12c4e10c51af /scripts
parentac814d32d13d831c197619165da173bf0c93e6e5 (diff)
add_filters lua script by Phillip Smith
Diffstat (limited to 'scripts')
-rw-r--r--scripts/add_filters.lua54
1 files changed, 54 insertions, 0 deletions
diff --git a/scripts/add_filters.lua b/scripts/add_filters.lua
new file mode 100644
index 0000000000..77b41c17bf
--- /dev/null
+++ b/scripts/add_filters.lua
@@ -0,0 +1,54 @@
+ardour {
+ ["type"] = "EditorAction",
+ name = "Add Filters",
+ license = "MIT",
+ author = "PSmith",
+ description = [[Add 'HPF/LPF' Lua Processor to all Tracks]]
+}
+
+function action_params ()
+ return
+ {
+ ["unique"] = { title = "Only add HPF/LPF if not already present (yes/no)", default = "yes"},
+ ["position"] = { title = "Insert Position from top (0,..)", default = "0"},
+ }
+end
+
+
+function factory (params)
+ return function ()
+ -- get configuration
+ local p = params or {}
+ local uniq = p["unique"] or "yes"
+ local pos = p["position"] or 0
+
+ -- loop over all tracks
+ for t in Session:get_tracks():iter() do
+ local insert = true;
+
+ -- check if filters are present
+ if uniq ~= "no" then
+ local proc;
+ local i = 0;
+ repeat
+ -- get Nth Ardour::Processor
+ proc = t:nth_plugin (i)
+ -- check if it's a filter
+ if (not proc:isnil() and proc:display_name () == "a-High/Low Pass Filter") then
+ insert = false;
+ end
+ i = i + 1
+ until proc:isnil() or insert == false
+ end
+
+ -- create a new processor and insert it
+ if insert then
+ local a = ARDOUR.LuaAPI.new_luaproc(Session, "a-High/Low Pass Filter");
+ if (not a:isnil()) then
+ t:add_processor_by_index(a, pos, nil, true)
+ a = nil -- explicitly drop shared-ptr reference
+ end
+ end
+ end
+ end
+end