From f771b0e88267e3e904c9d1611f8d89709e90f8e0 Mon Sep 17 00:00:00 2001 From: Nikolaus Gullotta Date: Wed, 1 Aug 2018 12:13:59 -0500 Subject: use is_nonbypassable(), is_channelstrip(), and display_to_user() to protect critical plugins, and add option to remove sends --- scripts/reset_mixer.lua | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'scripts') diff --git a/scripts/reset_mixer.lua b/scripts/reset_mixer.lua index 9b165f6af1..bdd1e3ae71 100644 --- a/scripts/reset_mixer.lua +++ b/scripts/reset_mixer.lua @@ -13,6 +13,7 @@ function factory() return function() { type = "checkbox", key = "mute", default = true, title = "Mute" }, { type = "checkbox", key = "trim", default = true, title = "Trim + Phase" }, { type = "checkbox", key = "plug", default = true, title = "Plug-ins" }, + { type = "checkbox", key = "sends", default = true, title = "Sends and inserts" }, { type = "checkbox", key = "dest", default = false, title = "Remove plug-ins instead of bypassing?" }, { type = "label", colspan="3", title = "" }, { type = "label", colspan="3", title = "Note that this is a script which can be user-edited to match your needs." }, @@ -44,26 +45,21 @@ function factory() return function() local proc = t:nth_processor (i) local queue = {} - local protected = { - "recorder", "latcomp-", "player", - "Polarity", "Trim", "Fader", - "meter-", "main outs", "Monitor", - } - repeat - local name = proc:display_name() - --check if processor is foreign to us - protected_proc = false - for _, v in pairs(protected) do - if string.find(name, v) then - --processor is not foreign to us - protected_proc = true + + if not(proc:to_ioprocessor():isnil()) then + --check if processor is a send or insert + if proc:to_ioprocessor():display_to_user() then + queue[#queue + 1] = proc end end - if not(protected_proc) and proc:display_to_user() then - print(name) - queue[#queue + 1] = proc + if not(proc:to_insert():isnil()) then + --check if processor is foreign to us + if not(proc:to_insert():is_channelstrip()) and proc:display_to_user() and not(proc:to_insert():is_nonbypassable()) then + --if it is, queue it for later + queue[#queue + 1] = proc + end end i = i + 1 @@ -71,7 +67,17 @@ function factory() return function() until proc:isnil() for p = 1, #queue do + if pref['sends'] then + if not(queue[p]:to_ioprocessor():isnil()) then + if not(pref["dest"]) then + queue[p]:deactivate() + else + t:remove_processor(queue[p], nil, true) + end + end + end if pref['plug'] then + print(queue[p]:display_name()) if not(pref["dest"]) then queue[p]:deactivate() else -- cgit v1.2.3