From 624743572cb7f0bda71b79137b4d210dfc50d33f Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 22 May 2016 09:46:40 -0400 Subject: [PATCH] reduce number of Controls attempted for auto-slave-on-assign; use just a single definition --- libs/ardour/slavable.cc | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/libs/ardour/slavable.cc b/libs/ardour/slavable.cc index 3467e94033..5cb8e8ddce 100644 --- a/libs/ardour/slavable.cc +++ b/libs/ardour/slavable.cc @@ -153,24 +153,27 @@ Slavable::unassign (boost::shared_ptr v) } } +/* Gain, solo & mute are currently the only controls that are + * automatically slaved to the master's own equivalent controls. + */ + +static AutomationType auto_slave_types[] = { + GainAutomation, + SoloAutomation, + MuteAutomation, + NullAutomation +}; + int Slavable::assign_controls (boost::shared_ptr vca) { boost::shared_ptr slave; boost::shared_ptr master; - AutomationType types[] = { - GainAutomation, - SoloAutomation, - MuteAutomation, - RecEnableAutomation, - MonitoringAutomation, - NullAutomation - }; - for (uint32_t n = 0; types[n] != NullAutomation; ++n) { + for (uint32_t n = 0; auto_slave_types[n] != NullAutomation; ++n) { - slave = boost::dynamic_pointer_cast (automation_control (types[n])); - master = vca->automation_control (types[n]); + slave = boost::dynamic_pointer_cast (automation_control (auto_slave_types[n])); + master = vca->automation_control (auto_slave_types[n]); if (slave && master) { slave->add_master (master); @@ -185,18 +188,10 @@ Slavable::unassign_controls (boost::shared_ptr vca) { boost::shared_ptr slave; boost::shared_ptr master; - AutomationType types[] = { - GainAutomation, - SoloAutomation, - MuteAutomation, - RecEnableAutomation, - MonitoringAutomation, - NullAutomation - }; - for (uint32_t n = 0; types[n] != NullAutomation; ++n) { + for (uint32_t n = 0; auto_slave_types[n] != NullAutomation; ++n) { - slave = boost::dynamic_pointer_cast (automation_control (types[n])); + slave = boost::dynamic_pointer_cast (automation_control (auto_slave_types[n])); if (!vca) { /* unassign from all */ @@ -204,7 +199,7 @@ Slavable::unassign_controls (boost::shared_ptr vca) slave->clear_masters (); } } else { - master = vca->automation_control (types[n]); + master = vca->automation_control (auto_slave_types[n]); if (slave && master) { slave->remove_master (master); }