diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2016-05-22 09:46:40 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-05-31 15:30:44 -0400 |
commit | 624743572cb7f0bda71b79137b4d210dfc50d33f (patch) | |
tree | 3bc5f718e57790e8c27ae7249be0d4ae34e20553 /libs/ardour/slavable.cc | |
parent | 4653e301c84a41bf3f32ffa1f23ac0a631fd89a9 (diff) |
reduce number of Controls attempted for auto-slave-on-assign; use just a single definition
Diffstat (limited to 'libs/ardour/slavable.cc')
-rw-r--r-- | libs/ardour/slavable.cc | 39 |
1 files 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<VCA> 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> vca) { boost::shared_ptr<SlavableAutomationControl> slave; boost::shared_ptr<AutomationControl> 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<SlavableAutomationControl> (automation_control (types[n])); - master = vca->automation_control (types[n]); + slave = boost::dynamic_pointer_cast<SlavableAutomationControl> (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> vca) { boost::shared_ptr<SlavableAutomationControl> slave; boost::shared_ptr<AutomationControl> 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<SlavableAutomationControl> (automation_control (types[n])); + slave = boost::dynamic_pointer_cast<SlavableAutomationControl> (automation_control (auto_slave_types[n])); if (!vca) { /* unassign from all */ @@ -204,7 +199,7 @@ Slavable::unassign_controls (boost::shared_ptr<VCA> 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); } |