mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 07:45:00 +01:00
RAII collect processor-change signals
This commit is contained in:
parent
b7c7c02680
commit
9875a95829
4 changed files with 30 additions and 19 deletions
|
|
@ -653,13 +653,17 @@ public:
|
||||||
{
|
{
|
||||||
g_atomic_int_inc (&s->_ignore_route_processor_changes);
|
g_atomic_int_inc (&s->_ignore_route_processor_changes);
|
||||||
}
|
}
|
||||||
~ProcessorChangeBlocker () {
|
|
||||||
|
~ProcessorChangeBlocker ()
|
||||||
|
{
|
||||||
if (g_atomic_int_dec_and_test (&_session->_ignore_route_processor_changes)) {
|
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) {
|
if (_reconfigure_on_delete) {
|
||||||
_session->route_processors_changed (RouteProcessorChange ());
|
_session->route_processors_changed (RouteProcessorChange ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
Session* _session;
|
Session* _session;
|
||||||
bool _reconfigure_on_delete;
|
bool _reconfigure_on_delete;
|
||||||
|
|
@ -2128,6 +2132,7 @@ private:
|
||||||
|
|
||||||
friend class ProcessorChangeBlocker;
|
friend class ProcessorChangeBlocker;
|
||||||
gint _ignore_route_processor_changes; /* atomic */
|
gint _ignore_route_processor_changes; /* atomic */
|
||||||
|
gint _ignored_a_processor_change;
|
||||||
|
|
||||||
MidiClockTicker* midi_clock;
|
MidiClockTicker* midi_clock;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -314,6 +314,7 @@ Session::Session (AudioEngine &eng,
|
||||||
, _suspend_timecode_transmission (0)
|
, _suspend_timecode_transmission (0)
|
||||||
, _speakers (new Speakers)
|
, _speakers (new Speakers)
|
||||||
, _ignore_route_processor_changes (0)
|
, _ignore_route_processor_changes (0)
|
||||||
|
, _ignored_a_processor_change (0)
|
||||||
, midi_clock (0)
|
, midi_clock (0)
|
||||||
, _scene_changer (0)
|
, _scene_changer (0)
|
||||||
, _midi_ports (0)
|
, _midi_ports (0)
|
||||||
|
|
|
||||||
|
|
@ -102,8 +102,10 @@ Session::process (pframes_t nframes)
|
||||||
* Route::process_output_buffers() but various functions
|
* Route::process_output_buffers() but various functions
|
||||||
* callig it hold a _processor_lock reader-lock
|
* callig it hold a _processor_lock reader-lock
|
||||||
*/
|
*/
|
||||||
boost::shared_ptr<RouteList> r = routes.reader ();
|
|
||||||
bool one_or_more_routes_declicking = false;
|
bool one_or_more_routes_declicking = false;
|
||||||
|
{
|
||||||
|
ProcessorChangeBlocker pcb (this);
|
||||||
|
boost::shared_ptr<RouteList> r = routes.reader ();
|
||||||
for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) {
|
for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) {
|
||||||
if ((*i)->apply_processor_changes_rt()) {
|
if ((*i)->apply_processor_changes_rt()) {
|
||||||
_rt_emit_pending = true;
|
_rt_emit_pending = true;
|
||||||
|
|
@ -112,6 +114,7 @@ Session::process (pframes_t nframes)
|
||||||
one_or_more_routes_declicking = true;
|
one_or_more_routes_declicking = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_rt_emit_pending) {
|
if (_rt_emit_pending) {
|
||||||
if (!_rt_thread_active) {
|
if (!_rt_thread_active) {
|
||||||
|
|
@ -1051,6 +1054,7 @@ Session::emit_route_signals ()
|
||||||
{
|
{
|
||||||
// TODO use RAII to allow using these signals in other places
|
// TODO use RAII to allow using these signals in other places
|
||||||
BatchUpdateStart(); /* EMIT SIGNAL */
|
BatchUpdateStart(); /* EMIT SIGNAL */
|
||||||
|
ProcessorChangeBlocker pcb (this);
|
||||||
boost::shared_ptr<RouteList> r = routes.reader ();
|
boost::shared_ptr<RouteList> r = routes.reader ();
|
||||||
for (RouteList::const_iterator ci = r->begin(); ci != r->end(); ++ci) {
|
for (RouteList::const_iterator ci = r->begin(); ci != r->end(); ++ci) {
|
||||||
(*ci)->emit_pending_signals ();
|
(*ci)->emit_pending_signals ();
|
||||||
|
|
|
||||||
|
|
@ -1851,6 +1851,7 @@ void
|
||||||
Session::route_processors_changed (RouteProcessorChange c)
|
Session::route_processors_changed (RouteProcessorChange c)
|
||||||
{
|
{
|
||||||
if (g_atomic_int_get (&_ignore_route_processor_changes) > 0) {
|
if (g_atomic_int_get (&_ignore_route_processor_changes) > 0) {
|
||||||
|
g_atomic_int_set (&_ignored_a_processor_change, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue