summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2020-04-18 23:54:24 +0200
committerRobin Gareus <robin@gareus.org>2020-04-18 23:54:24 +0200
commit9875a958295353aabba73fb05f862c4f92ebb219 (patch)
treef4cb3e16bd776483c4f90f0d964d288a797ddd52
parentb7c7c02680fc89f58af46498b5d6459b30a07b2d (diff)
RAII collect processor-change signals6.0-rc1
-rw-r--r--libs/ardour/ardour/session.h29
-rw-r--r--libs/ardour/session.cc1
-rw-r--r--libs/ardour/session_process.cc18
-rw-r--r--libs/ardour/session_transport.cc1
4 files changed, 30 insertions, 19 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 4c93ecb95f..4c259232f5 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -646,23 +646,27 @@ public:
};
class ProcessorChangeBlocker {
- public:
- ProcessorChangeBlocker (Session* s, bool rc = true)
- : _session (s)
- , _reconfigure_on_delete (rc)
- {
- g_atomic_int_inc (&s->_ignore_route_processor_changes);
- }
- ~ProcessorChangeBlocker () {
- if (g_atomic_int_dec_and_test (&_session->_ignore_route_processor_changes)) {
+ public:
+ ProcessorChangeBlocker (Session* s, bool rc = true)
+ : _session (s)
+ , _reconfigure_on_delete (rc)
+ {
+ g_atomic_int_inc (&s->_ignore_route_processor_changes);
+ }
+
+ ~ProcessorChangeBlocker ()
+ {
+ if (g_atomic_int_dec_and_test (&_session->_ignore_route_processor_changes)) {
+ if (g_atomic_int_compare_and_exchange (&_session->_ignored_a_processor_change, 1, 0)) {
if (_reconfigure_on_delete) {
_session->route_processors_changed (RouteProcessorChange ());
}
}
}
- private:
- Session* _session;
- bool _reconfigure_on_delete;
+ }
+ private:
+ Session* _session;
+ bool _reconfigure_on_delete;
};
RouteGroup* new_route_group (const std::string&);
@@ -2128,6 +2132,7 @@ private:
friend class ProcessorChangeBlocker;
gint _ignore_route_processor_changes; /* atomic */
+ gint _ignored_a_processor_change;
MidiClockTicker* midi_clock;
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 0c73acdaa5..253a80a4b3 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -314,6 +314,7 @@ Session::Session (AudioEngine &eng,
, _suspend_timecode_transmission (0)
, _speakers (new Speakers)
, _ignore_route_processor_changes (0)
+ , _ignored_a_processor_change (0)
, midi_clock (0)
, _scene_changer (0)
, _midi_ports (0)
diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc
index f5613d3af4..828299d8e0 100644
--- a/libs/ardour/session_process.cc
+++ b/libs/ardour/session_process.cc
@@ -102,14 +102,17 @@ Session::process (pframes_t nframes)
* Route::process_output_buffers() but various functions
* callig it hold a _processor_lock reader-lock
*/
- boost::shared_ptr<RouteList> r = routes.reader ();
bool one_or_more_routes_declicking = false;
- for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) {
- if ((*i)->apply_processor_changes_rt()) {
- _rt_emit_pending = true;
- }
- if ((*i)->declick_in_progress()) {
- one_or_more_routes_declicking = true;
+ {
+ ProcessorChangeBlocker pcb (this);
+ boost::shared_ptr<RouteList> r = routes.reader ();
+ for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) {
+ if ((*i)->apply_processor_changes_rt()) {
+ _rt_emit_pending = true;
+ }
+ if ((*i)->declick_in_progress()) {
+ one_or_more_routes_declicking = true;
+ }
}
}
@@ -1051,6 +1054,7 @@ Session::emit_route_signals ()
{
// TODO use RAII to allow using these signals in other places
BatchUpdateStart(); /* EMIT SIGNAL */
+ ProcessorChangeBlocker pcb (this);
boost::shared_ptr<RouteList> r = routes.reader ();
for (RouteList::const_iterator ci = r->begin(); ci != r->end(); ++ci) {
(*ci)->emit_pending_signals ();
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index f136eebc5d..2924629d88 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -1851,6 +1851,7 @@ void
Session::route_processors_changed (RouteProcessorChange c)
{
if (g_atomic_int_get (&_ignore_route_processor_changes) > 0) {
+ g_atomic_int_set (&_ignored_a_processor_change, 1);
return;
}