diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2016-03-04 16:44:30 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-05-31 15:30:39 -0400 |
commit | 00b7385e4c1b8ab341f827323eeca77109349ef0 (patch) | |
tree | 4d29ef8c0ab8e57c2f3a3b900921f95ec3e4590d /libs/ardour/gain_control.cc | |
parent | aa80321976726b745741ce525f2b1b1becb29671 (diff) |
correctly restore VCA-VCA slave/master relationships at session load time
Diffstat (limited to 'libs/ardour/gain_control.cc')
-rw-r--r-- | libs/ardour/gain_control.cc | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/libs/ardour/gain_control.cc b/libs/ardour/gain_control.cc index b9c381c406..3eff20b1f1 100644 --- a/libs/ardour/gain_control.cc +++ b/libs/ardour/gain_control.cc @@ -348,22 +348,41 @@ GainControl::set_state (XMLNode const& node, int version) XMLProperty const* prop = node.property (X_("masters")); - /* XXX Problem here if we allow VCA's to be slaved to other VCA's .. we - * have to load all VCAs first, then call ::set_state() so that - * vca_by_number() will succeed. + /* Problem here if we allow VCA's to be slaved to other VCA's .. we + * have to load all VCAs first, then set up slave/master relationships + * once we have them all. */ if (prop) { - vector<string> masters; - split (prop->value(), masters, ','); + masters_string = prop->value (); - for (vector<string>::const_iterator m = masters.begin(); m != masters.end(); ++m) { - boost::shared_ptr<VCA> vca = _session.vca_manager().vca_by_number (PBD::atoi (*m)); - if (vca) { - add_master (vca); - } + if (_session.vca_manager().vcas_loaded()) { + vcas_loaded (); + } else { + _session.vca_manager().VCAsLoaded.connect_same_thread (vca_loaded_connection, boost::bind (&GainControl::vcas_loaded, this)); } } return 0; } + +void +GainControl::vcas_loaded () +{ + if (masters_string.empty()) { + return; + } + + vector<string> masters; + split (masters_string, masters, ','); + + for (vector<string>::const_iterator m = masters.begin(); m != masters.end(); ++m) { + boost::shared_ptr<VCA> vca = _session.vca_manager().vca_by_number (PBD::atoi (*m)); + if (vca) { + add_master (vca); + } + } + + vca_loaded_connection.disconnect (); + masters_string.clear (); +} |