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;
}
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;