mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 23:05:04 +01:00
Add a Lua Action Script to add scopes to all tracks
This commit is contained in:
parent
79ea6c8248
commit
abd65cfc70
1 changed files with 55 additions and 0 deletions
55
scripts/addscopes.lua
Normal file
55
scripts/addscopes.lua
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
ardour {
|
||||||
|
["type"] = "EditorAction",
|
||||||
|
name = "Add Scopes",
|
||||||
|
license = "MIT",
|
||||||
|
author = "Robin Gareus",
|
||||||
|
email = "robin@gareus.org",
|
||||||
|
site = "http://gareus.org",
|
||||||
|
description = [[Add 'Inline Scope' Lua Processor to all Tracks]]
|
||||||
|
}
|
||||||
|
|
||||||
|
function action_params ()
|
||||||
|
return
|
||||||
|
{
|
||||||
|
["unique"] = { title = "Only add Scope if non is present already (yes/no)", default = "yes"},
|
||||||
|
["position"] = { title = "Insert Position from top (0,..)", default = "0"},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function factory (params)
|
||||||
|
return function ()
|
||||||
|
-- get configuration
|
||||||
|
local uniq = params["unique"] or "yes"
|
||||||
|
local pos = params["position"] or 0
|
||||||
|
|
||||||
|
-- loop over all tracks
|
||||||
|
for t in Session:get_tracks():iter() do
|
||||||
|
local insert = true;
|
||||||
|
|
||||||
|
-- check if a scope is already 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 scope
|
||||||
|
if (not proc:isnil() and proc:display_name () == "Inline Scope") 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, "Inline Scope");
|
||||||
|
if (not a:isnil()) then
|
||||||
|
t:add_processor_by_index(a, pos, nil, true)
|
||||||
|
a = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Add table
Add a link
Reference in a new issue