summaryrefslogtreecommitdiff
path: root/libs/ardour/vca.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-04-25 12:31:18 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-05-31 15:30:41 -0400
commit52b150ba5dda50e52a5e1bfa0aeb900defce3d54 (patch)
treed87de4568fb07593db6620ae7a5ce6a39eccc36a /libs/ardour/vca.cc
parentf2984260d481b7e2b641382e7d593ed701e464a3 (diff)
generalize VCA assign/unassign code.
Need to share this approach across Slavables
Diffstat (limited to 'libs/ardour/vca.cc')
-rw-r--r--libs/ardour/vca.cc52
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;