diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2017-02-06 16:18:09 +0100 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2017-02-06 16:49:08 +0100 |
commit | edd1061c3d8822ab586e2bbc80894e125b521a52 (patch) | |
tree | 37e171eb88ca33ade64cf07cbf98bb518a6c0f70 /libs/ardour/slavable.cc | |
parent | 4161a602449ebfff5ff5a9327807100f799e3dd3 (diff) |
save/restore VCA master state inside slaves, so that a reloaded session ends up back in the same state
Diffstat (limited to 'libs/ardour/slavable.cc')
-rw-r--r-- | libs/ardour/slavable.cc | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/libs/ardour/slavable.cc b/libs/ardour/slavable.cc index 61a11f257d..35063fa35f 100644 --- a/libs/ardour/slavable.cc +++ b/libs/ardour/slavable.cc @@ -84,6 +84,17 @@ Slavable::set_state (XMLNode const& node, int version) } +/* 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::do_assign (VCAManager* manager) { @@ -104,8 +115,22 @@ Slavable::do_assign (VCAManager* manager) /* now that we've released the lock, we can do the assignments */ - for (std::vector<boost::shared_ptr<VCA> >::iterator v = vcas.begin(); v != vcas.end(); ++v) { - assign (*v); + if (!vcas.empty()) { + + for (std::vector<boost::shared_ptr<VCA> >::iterator v = vcas.begin(); v != vcas.end(); ++v) { + assign (*v, true); + } + + for (uint32_t n = 0; auto_slave_types[n] != NullAutomation; ++n) { + + boost::shared_ptr<SlavableAutomationControl> slave; + + slave = boost::dynamic_pointer_cast<SlavableAutomationControl> (automation_control (auto_slave_types[n])); + + if (slave) { + slave->use_saved_master_ratios (); + } + } } assign_connection.disconnect (); @@ -114,12 +139,12 @@ Slavable::do_assign (VCAManager* manager) } void -Slavable::assign (boost::shared_ptr<VCA> v) +Slavable::assign (boost::shared_ptr<VCA> v, bool loading) { assert (v); { Glib::Threads::RWLock::WriterLock lm (master_lock); - if (assign_controls (v) == 0) { + if (assign_controls (v, loading) == 0) { _masters.insert (v->number()); } @@ -161,19 +186,8 @@ Slavable::unassign (boost::shared_ptr<VCA> v) AssignmentChange (v, false); } -/* 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) +Slavable::assign_controls (boost::shared_ptr<VCA> vca, bool loading) { boost::shared_ptr<SlavableAutomationControl> slave; boost::shared_ptr<AutomationControl> master; @@ -184,7 +198,7 @@ Slavable::assign_controls (boost::shared_ptr<VCA> vca) master = vca->automation_control (auto_slave_types[n]); if (slave && master) { - slave->add_master (master); + slave->add_master (master, loading); } } |