summaryrefslogtreecommitdiff
path: root/libs/ardour/route.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-04-03 05:14:05 +0200
committerRobin Gareus <robin@gareus.org>2016-04-03 05:16:54 +0200
commit6739b6a1e31f943f039b3c1678190af4fe0f8d16 (patch)
treeedf9d99959af1852b87575b55ebb113d13b27f3f /libs/ardour/route.cc
parent071c72a9770792044a0758b910067cfd4ddd000a (diff)
handle sidechain input changes
Diffstat (limited to 'libs/ardour/route.cc')
-rw-r--r--libs/ardour/route.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 76f88a3ce2..44c0028926 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -115,6 +115,7 @@ Route::Route (Session& sess, string name, Flag flg, DataType default_type)
, _track_number (0)
, _in_configure_processors (false)
, _initial_io_setup (false)
+ , _in_sidechain_setup (false)
, _strict_io (false)
, _custom_meter_position_noted (false)
{
@@ -2439,6 +2440,7 @@ Route::add_remove_sidechain (boost::shared_ptr<Processor> proc, bool add)
{
Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock ()); // take before Writerlock to avoid deadlock
Glib::Threads::RWLock::WriterLock lm (_processor_lock);
+ PBD::Unwinder<bool> uw (_in_sidechain_setup, true);
lx.release (); // IO::add_port() and ~IO takes process lock - XXX check if this is safe
if (add) {
@@ -2468,6 +2470,10 @@ Route::add_remove_sidechain (boost::shared_ptr<Processor> proc, bool add)
configure_processors_unlocked (0);
}
+ if (pi->has_sidechain ()) {
+ pi->sidechain_input ()->changed.connect_same_thread (*this, boost::bind (&Route::sidechain_change_handler, this, _1, _2));
+ }
+
processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */
_session.set_dirty ();
return true;
@@ -3300,6 +3306,12 @@ Route::set_processor_state (const XMLNode& node)
processor.reset (new UnknownProcessor (_session, **niter));
}
+ /* subscribe to Sidechain IO changes */
+ boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (processor);
+ if (pi && pi->has_sidechain ()) {
+ pi->sidechain_input ()->changed.connect_same_thread (*this, boost::bind (&Route::sidechain_change_handler, this, _1, _2));
+ }
+
/* we have to note the monitor send here, otherwise a new one will be created
and the state of this one will be lost.
*/
@@ -3808,6 +3820,21 @@ Route::output_change_handler (IOChange change, void * /*src*/)
}
}
+void
+Route::sidechain_change_handler (IOChange change, void * /*src*/)
+{
+ if (_initial_io_setup || _in_sidechain_setup) {
+ return;
+ }
+
+ if ((change.type & IOChange::ConfigurationChanged)) {
+ /* This is called with the process lock held if change
+ contains ConfigurationChanged
+ */
+ configure_processors (0);
+ }
+}
+
uint32_t
Route::pans_required () const
{