mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-11 09:06:33 +01:00
Add Slavable::AssignmentChanged signal to notify when a slavable is assigned/unassigned to/from a master
This commit is contained in:
parent
afa6720288
commit
e37bfffca5
2 changed files with 27 additions and 17 deletions
|
|
@ -52,6 +52,8 @@ class LIBARDOUR_API Slavable
|
||||||
void assign (boost::shared_ptr<VCA>);
|
void assign (boost::shared_ptr<VCA>);
|
||||||
void unassign (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;
|
virtual boost::shared_ptr<AutomationControl> automation_control (const Evoral::Parameter& id) = 0;
|
||||||
|
|
||||||
static std::string xml_node_name;
|
static std::string xml_node_name;
|
||||||
|
|
|
||||||
|
|
@ -117,19 +117,23 @@ void
|
||||||
Slavable::assign (boost::shared_ptr<VCA> v)
|
Slavable::assign (boost::shared_ptr<VCA> v)
|
||||||
{
|
{
|
||||||
assert (v);
|
assert (v);
|
||||||
Glib::Threads::RWLock::WriterLock lm (master_lock);
|
{
|
||||||
if (assign_controls (v) == 0) {
|
Glib::Threads::RWLock::WriterLock lm (master_lock);
|
||||||
_masters.insert (v->number());
|
if (assign_controls (v) == 0) {
|
||||||
|
_masters.insert (v->number());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Do NOT use ::unassign() because it will store a
|
||||||
|
* boost::shared_ptr<VCA> in the functor, leaving a dangling ref to the
|
||||||
|
* VCA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
v->Drop.connect_same_thread (unassign_connections, boost::bind (&Slavable::weak_unassign, this, boost::weak_ptr<VCA>(v)));
|
||||||
|
v->DropReferences.connect_same_thread (unassign_connections, boost::bind (&Slavable::weak_unassign, this, boost::weak_ptr<VCA>(v)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do NOT use ::unassign() because it will store a
|
AssignmentChange (v, true);
|
||||||
* boost::shared_ptr<VCA> in the functor, leaving a dangling ref to the
|
|
||||||
* VCA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
v->Drop.connect_same_thread (unassign_connections, boost::bind (&Slavable::weak_unassign, this, boost::weak_ptr<VCA>(v)));
|
|
||||||
v->DropReferences.connect_same_thread (unassign_connections, boost::bind (&Slavable::weak_unassign, this, boost::weak_ptr<VCA>(v)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -144,13 +148,17 @@ Slavable::weak_unassign (boost::weak_ptr<VCA> v)
|
||||||
void
|
void
|
||||||
Slavable::unassign (boost::shared_ptr<VCA> v)
|
Slavable::unassign (boost::shared_ptr<VCA> v)
|
||||||
{
|
{
|
||||||
Glib::Threads::RWLock::WriterLock lm (master_lock);
|
{
|
||||||
(void) unassign_controls (v);
|
Glib::Threads::RWLock::WriterLock lm (master_lock);
|
||||||
if (v) {
|
|
||||||
_masters.erase (v->number());
|
(void) unassign_controls (v);
|
||||||
} else {
|
if (v) {
|
||||||
_masters.clear ();
|
_masters.erase (v->number());
|
||||||
|
} else {
|
||||||
|
_masters.clear ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
AssignmentChange (v, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Gain, solo & mute are currently the only controls that are
|
/* Gain, solo & mute are currently the only controls that are
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue