From efe943c98ed39da9f441b4be8c05345c8d0d9aec Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 23 Jan 2023 03:16:25 +0100 Subject: [PATCH] Reimplement Route::shift, move all automation --- libs/ardour/route.cc | 51 ++++++++++++-------------------------------- 1 file changed, 14 insertions(+), 37 deletions(-) diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 79fe4865dc..980db8e7e9 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -4521,45 +4521,22 @@ Route::protect_automation () void Route::shift (timepos_t const & pos, timecnt_t const & distance) { - /* pan automation */ - if (_pannable) { - ControlSet::Controls& c (_pannable->controls()); - - for (ControlSet::Controls::const_iterator ci = c.begin(); ci != c.end(); ++ci) { - boost::shared_ptr pc = boost::dynamic_pointer_cast (ci->second); - if (pc) { - boost::shared_ptr al = pc->alist(); - XMLNode& before = al->get_state (); - al->shift (pos, timecnt_t (distance)); - XMLNode& after = al->get_state (); - _session.add_command (new MementoCommand (*al.get(), &before, &after)); - } + ControllableSet acs; + automatables (acs); + for (auto& ec : acs) { + boost::shared_ptr ac = boost::dynamic_pointer_cast (ec); + if (!ac) { + continue; } - } - - /* TODO mute automation, MuteControl */ - - /* processor automation (incl. gain, trim,..) */ - { - Glib::Threads::RWLock::ReaderLock lm (_processor_lock); - for (ProcessorList::iterator i = _processors.begin (); i != _processors.end (); ++i) { - - set parameters = (*i)->what_can_be_automated(); - - for (set::const_iterator p = parameters.begin (); p != parameters.end (); ++p) { - boost::shared_ptr ac = (*i)->automation_control (*p); - if (ac) { - boost::shared_ptr al = ac->alist(); - if (al->empty ()) { - continue; - } - XMLNode &before = al->get_state (); - al->shift (pos, distance); - XMLNode &after = al->get_state (); - _session.add_command (new MementoCommand (*al.get(), &before, &after)); - } - } + boost::shared_ptr al = ac->alist(); + if (!al || al->empty ()) { + continue; } + + XMLNode &before = al->get_state (); + al->shift (pos, timecnt_t (distance)); + XMLNode& after = al->get_state (); + _session.add_command (new MementoCommand (*al.get(), &before, &after)); } }