Help with changing a Lua script (reset dragonfly room reverb)

Some time ago we discussed a problem with dragonfly room reverb causing crackles after loading an ardour session.
Dragonfly reverb distortion - #17 by dave_odl

This resulted in a Lua script which runs on startup and i think it might be too early in the startup process.
Can somebody change this script, so that i can run it whenever i want it?

ardour {
  ["type"] = "EditorHook",
  name = "Reset Dragonfly Reverbs on Session Load",
  license = "MIT",
  author = "Ccee",
  description = "Disables and re-enables all Dragonfly Reverb plugins on session load"
}

function signals ()
  return LuaSignal.Set():add ({
        [LuaSignal.SetSession] = true
    })
end

function factory ()
  return function (signal, ref, ...)
    print("Resetting Dragonfly Reverbs...")

    for route in Session:get_routes():iter() do
      local i = 0
      repeat
        local p = route:nth_processor(i)
        if not p:isnil() then
          local name = p:display_name() or ""
          if name:lower():find("dragonfly") then
            print("Resetting plugin: " .. name .. " on track: " .. route:name())
            p:deactivate()
            p:activate()
          end
        end
        i = i + 1
      until p:isnil()
    end

    print("Done resetting Dragonfly Reverbs.")
  end
end
2 Likes

Just change the script type from “EditorHook” to → “EditorAction”, then erase the first bit (“function signals ()”… -which establishes the ‘trigger’ for running the script, in this case on session-startup), and then also “signal, ref, …” (-which is now unnecessary).

(…I also changed the name/description for you.)

ardour {
  ["type"] = "EditorAction",
  name = "Reset Dragonfly Reverbs",
  license = "MIT",
  author = "Ccee",
  description = "Disables and re-enables all Dragonfly Reverb plugins"
}

function factory ()
  return function ()
    print("Resetting Dragonfly Reverbs...")

    for route in Session:get_routes():iter() do
      local i = 0
      repeat
        local p = route:nth_processor(i)
        if not p:isnil() then
          local name = p:display_name() or ""
          if name:lower():find("dragonfly") then
            print("Resetting plugin: " .. name .. " on track: " .. route:name())
            p:deactivate()
            p:activate()
          end
        end
        i = i + 1
      until p:isnil()
    end

    print("Done resetting Dragonfly Reverbs.")
  end
end

Test it out and let me know if it works for you.

:+1: :v:
-J

2 Likes

The script works! At least it prints the right messages to the log. :slight_smile:
But unfortunately that does not change the behaviour.
Thanks for helping! :slight_smile:
:v:

I wonder why the behaviour is different from when i deactivate and activate manually…

Yo,

I just downloaded the Dragonfly plugins so I could test this script, and it definitely is finding and deactivating and activating them appropriately. I first --muted the line of the code that re-activates them, just to prove that deactivation does in fact work:

Ardour (8,12) - Reset Dragonfly Plugins - Test 1

So you’re correct. This script does “work” in and of itself. But I’m sorry to hear it’s not actually solving your plugin issue…

What version of the plugins are you using? LV2 ones?
You might want to try others.

Also, for me the Hall, Plate, and Room reverbs seem to work just fine (-all LV2).
-But “Dragonfly Early Reflections” freezes Ardour every single time I try to open it…
Hmm…

-J

I am using the LV2 Version but when i try to use the vst3 version it gives me the same problem.
Thanks again! :slight_smile:

Presumably since when you do it manually there is a delay between deactivation and reactivation. Perhaps you want to introduce that delay into the script?

Lua doesn’t have a sleep or wait function, but see here for options:

http://lua-users.org/wiki/SleepFunction