From: Robin Gareus Date: Fri, 3 Jun 2016 21:09:08 +0000 (+0200) Subject: allow latent self-automating plugins X-Git-Tag: 5.0-pre1~698 X-Git-Url: https://main.carlh.net/gitweb/?p=ardour.git;a=commitdiff_plain;h=56a5dd92af961797d771420aeaf6f9ab221864ec allow latent self-automating plugins --- diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index 9e253a359f..ca0a5b45e3 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -2472,11 +2472,13 @@ LV2Plugin::connect_and_run(BufferSet& bufs, // -> add automation event.. AutomationCtrlPtr c = get_automation_control (p); if (c && c->ac->automation_state() == Touch) { + framepos_t when = std::max ((framepos_t) 0, _session.transport_frame() + frames - _current_latency); + assert (_session.transport_frame() + frames - _current_latency >= 0); if (c->guard) { c->guard = false; - c->ac->list()->add (_session.transport_frame() + frames, v, true, true); + c->ac->list()->add (when, v, true, true); } else { - c->ac->set_double (v, _session.transport_frame() + frames, true); + c->ac->set_double (v, when, true); } } } @@ -2501,7 +2503,7 @@ LV2Plugin::connect_and_run(BufferSet& bufs, const uint32_t p = ((const LV2_Atom_Int*)parameter)->body; AutomationCtrlPtr c = get_automation_control (p); if (c) { - c->ac->start_touch (_session.transport_frame()); + c->ac->start_touch (std::max ((framepos_t)0, _session.transport_frame() - _current_latency)); c->guard = true; } } @@ -2515,7 +2517,7 @@ LV2Plugin::connect_and_run(BufferSet& bufs, const uint32_t p = ((const LV2_Atom_Int*)parameter)->body; AutomationCtrlPtr c = get_automation_control (p); if (c) { - c->ac->stop_touch (true, _session.transport_frame()); + c->ac->stop_touch (true, std::max ((framepos_t)0, _session.transport_frame() - _current_latency)); } } }