-
-void
-AutomationControl::add_master (boost::shared_ptr<AutomationControl> m)
-{
- double current_value;
- std::pair<Masters::iterator,bool> res;
-
- {
- Glib::Threads::RWLock::WriterLock lm (master_lock);
- current_value = get_value_locked ();
-
- /* ratio will be recomputed below */
-
- res = _masters.insert (make_pair<PBD::ID,MasterRecord> (m->id(), MasterRecord (m, 1.0)));
-
- if (res.second) {
-
- recompute_masters_ratios (current_value);
-
- /* note that we bind @param m as a weak_ptr<AutomationControl>, thus
- avoiding holding a reference to the control in the binding
- itself.
- */
-
- m->DropReferences.connect_same_thread (masters_connections, boost::bind (&AutomationControl::master_going_away, this, m));
-
- /* Store the connection inside the MasterRecord, so that when we destroy it, the connection is destroyed
- and we no longer hear about changes to the AutomationControl.
- */
-
- m->Changed.connect_same_thread (res.first->second.connection, boost::bind (&PBD::Signal0<void>::operator(), &Changed));
- }
- }
-
- if (res.second) {
- MasterStatusChange (); /* EMIT SIGNAL */
- }
-}
-
-void
-AutomationControl::master_going_away (boost::weak_ptr<AutomationControl> wm)
-{
- boost::shared_ptr<AutomationControl> m = wm.lock();
- if (m) {
- remove_master (m);
- }
-}
-