13
0

Add Slavable::AssignmentChanged signal to notify when a slavable is assigned/unassigned to/from a master

This commit is contained in:
Paul Davis 2016-12-12 18:43:47 +00:00
parent afa6720288
commit e37bfffca5
2 changed files with 27 additions and 17 deletions

View File

@ -52,6 +52,8 @@ class LIBARDOUR_API Slavable
void assign (boost::shared_ptr<VCA>);
void unassign (boost::shared_ptr<VCA>);
PBD::Signal2<void,boost::shared_ptr<VCA>,bool> AssignmentChange;
virtual boost::shared_ptr<AutomationControl> automation_control (const Evoral::Parameter& id) = 0;
static std::string xml_node_name;

View File

@ -117,6 +117,7 @@ void
Slavable::assign (boost::shared_ptr<VCA> v)
{
assert (v);
{
Glib::Threads::RWLock::WriterLock lm (master_lock);
if (assign_controls (v) == 0) {
_masters.insert (v->number());
@ -132,6 +133,9 @@ Slavable::assign (boost::shared_ptr<VCA> v)
v->DropReferences.connect_same_thread (unassign_connections, boost::bind (&Slavable::weak_unassign, this, boost::weak_ptr<VCA>(v)));
}
AssignmentChange (v, true);
}
void
Slavable::weak_unassign (boost::weak_ptr<VCA> v)
{
@ -143,8 +147,10 @@ Slavable::weak_unassign (boost::weak_ptr<VCA> v)
void
Slavable::unassign (boost::shared_ptr<VCA> v)
{
{
Glib::Threads::RWLock::WriterLock lm (master_lock);
(void) unassign_controls (v);
if (v) {
_masters.erase (v->number());
@ -152,6 +158,8 @@ Slavable::unassign (boost::shared_ptr<VCA> v)
_masters.clear ();
}
}
AssignmentChange (v, false);
}
/* Gain, solo & mute are currently the only controls that are
* automatically slaved to the master's own equivalent controls.