diff options
-rw-r--r-- | libs/ardour/vca.cc | 52 |
1 files changed, 40 insertions, 12 deletions
diff --git a/libs/ardour/vca.cc b/libs/ardour/vca.cc index d1e93cc403..2d1fbdec8f 100644 --- a/libs/ardour/vca.cc +++ b/libs/ardour/vca.cc @@ -164,9 +164,26 @@ VCA::clear_all_solo_state () int VCA::assign_controls (boost::shared_ptr<VCA> vca) { - _gain_control->add_master (vca->gain_control()); - _solo_control->add_master (vca->solo_control()); - _mute_control->add_master (vca->mute_control()); + 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) { + + slave = boost::dynamic_pointer_cast<SlavableAutomationControl> (automation_control (types[n])); + master = vca->automation_control (types[n]); + + if (slave && master) { + slave->add_master (master); + } + } return 0; } @@ -174,15 +191,26 @@ VCA::assign_controls (boost::shared_ptr<VCA> vca) int VCA::unassign_controls (boost::shared_ptr<VCA> vca) { - if (!vca) { - /* unassign from all */ - _gain_control->clear_masters (); - _solo_control->clear_masters (); - _mute_control->clear_masters (); - } else { - _gain_control->remove_master (vca->gain_control()); - _solo_control->remove_master (vca->solo_control()); - _mute_control->remove_master (vca->mute_control()); + 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) { + + slave = boost::dynamic_pointer_cast<SlavableAutomationControl> (automation_control (types[n])); + if (!vca) { + /* unassign from all */ + slave->clear_masters (); + } else { + slave->remove_master (master); + } } return 0; |