diff options
author | Robin Gareus <robin@gareus.org> | 2020-03-14 12:36:00 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-03-14 13:25:54 +0100 |
commit | 8f378650700930dba1865cb1bdf1895223e6dd43 (patch) | |
tree | ece9ba2718ce61a09361469256ff22e7ec1663eb | |
parent | 97f3d9496bdb602305cf522f10b21124af8aef40 (diff) |
Prevent freeze/bounce of sidechain processors
This also consolidates code to test if a processor can be frozen
from various places.
-rw-r--r-- | libs/ardour/ardour/route.h | 2 | ||||
-rw-r--r-- | libs/ardour/audio_track.cc | 20 | ||||
-rw-r--r-- | libs/ardour/route.cc | 52 |
3 files changed, 45 insertions, 29 deletions
diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index f53efe3fd2..a24d102555 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -608,6 +608,8 @@ protected: samplecnt_t bounce_get_latency (boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze) const; ChanCount bounce_get_output_streams (ChanCount &cc, boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze) const; + bool can_freeze_processor (boost::shared_ptr<Processor>, bool allow_routing = false) const; + bool _active; samplecnt_t _signal_latency; diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index b90d1392b6..692549551d 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -406,21 +406,23 @@ AudioTrack::freeze_me (InterThreadInfo& itt) for (ProcessorList::iterator r = _processors.begin(); r != _processors.end(); ++r) { - if ((*r)->does_routing() && (*r)->active()) { + if (boost::dynamic_pointer_cast<PeakMeter>(*r)) { + continue; + } + + if (!can_freeze_processor (*r)) { break; } - if (!boost::dynamic_pointer_cast<PeakMeter>(*r)) { - FreezeRecordProcessorInfo* frii = new FreezeRecordProcessorInfo ((*r)->get_state(), (*r)); + FreezeRecordProcessorInfo* frii = new FreezeRecordProcessorInfo ((*r)->get_state(), (*r)); - frii->id = (*r)->id(); + frii->id = (*r)->id(); - _freeze_record.processor_info.push_back (frii); + _freeze_record.processor_info.push_back (frii); - /* now deactivate the processor, */ - if (!boost::dynamic_pointer_cast<Amp>(*r)) { - (*r)->deactivate (); - } + /* now deactivate the processor, */ + if (!boost::dynamic_pointer_cast<Amp>(*r)) { + (*r)->deactivate (); } _session.set_dirty (); diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 91c9a1a1cf..15791f4901 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -564,10 +564,7 @@ Route::bounce_process (BufferSet& buffers, samplepos_t start, samplecnt_t nframe } /* if we're *not* exporting, stop processing if we come across a routing processor. */ - if (!for_export && boost::dynamic_pointer_cast<PortInsert>(*i)) { - break; - } - if (!for_export && for_freeze && (*i)->does_routing() && (*i)->active()) { + if (!for_export && !can_freeze_processor (*i, !for_freeze)) { break; } @@ -618,10 +615,7 @@ Route::bounce_get_latency (boost::shared_ptr<Processor> endpoint, } continue; } - if (!for_export && boost::dynamic_pointer_cast<PortInsert>(*i)) { - break; - } - if (!for_export && for_freeze && (*i)->does_routing() && (*i)->active()) { + if (!for_export && !can_freeze_processor (*i, !for_freeze)) { break; } if (!(*i)->does_routing() && !boost::dynamic_pointer_cast<PeakMeter>(*i)) { @@ -646,10 +640,7 @@ Route::bounce_get_output_streams (ChanCount &cc, boost::shared_ptr<Processor> en if (!include_endpoint && (*i) == endpoint) { break; } - if (!for_export && boost::dynamic_pointer_cast<PortInsert>(*i)) { - break; - } - if (!for_export && for_freeze && (*i)->does_routing() && (*i)->active()) { + if (!for_export && !can_freeze_processor (*i, !for_freeze)) { break; } if (!(*i)->does_routing() && !boost::dynamic_pointer_cast<PeakMeter>(*i)) { @@ -5177,19 +5168,40 @@ Route::metering_state () const } bool -Route::has_external_redirects () const +Route::can_freeze_processor (boost::shared_ptr<Processor> p, bool allow_routing) const { - for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) { + /* ignore inactive processors and obviously ignore the main + * outs since everything has them and we don't care. + */ + if (!p->active()) { + return true; + } - /* ignore inactive processors and obviously ignore the main - * outs since everything has them and we don't care. - */ + if (p != _main_outs && p->does_routing()) { + return allow_routing; + } - if ((*i)->active() && (*i) != _main_outs && (*i)->does_routing()) { - return true;; - } + if (boost::dynamic_pointer_cast<PortInsert>(p)) { + return false; } + boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert>(p); + if (pi && pi->has_sidechain () && pi->sidechain_input () && pi->sidechain_input ()->connected()) { + return false; + } + + return true; +} + +bool +Route::has_external_redirects () const +{ + Glib::Threads::RWLock::ReaderLock lm (_processor_lock); + for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) { + if (!can_freeze_processor (*i)) { + return true; + } + } return false; } |