+ Glib::RWLock::ReaderLock lm (_processor_lock);
+
+ for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
+ if ((*i)->placement() == p) {
+ (*i)->set_active (false);
+ }
+ }
+
+ _session.set_dirty ();
+}
+
+/** Turn off all redirects
+ */
+
+void
+Route::disable_processors ()
+{
+ Glib::RWLock::ReaderLock lm (_processor_lock);
+
+ for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
+ (*i)->set_active (false);
+ }
+
+ _session.set_dirty ();
+}
+
+/** Turn off all redirects with a given placement
+ * @param p Placement of redirects to disable
+ */
+
+void
+Route::disable_plugins (Placement p)
+{
+ Glib::RWLock::ReaderLock lm (_processor_lock);
+
+ for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
+ if (boost::dynamic_pointer_cast<PluginInsert> (*i) && (*i)->placement() == p) {
+ (*i)->set_active (false);
+ }
+ }
+
+ _session.set_dirty ();
+}
+
+/** Turn off all plugins
+ */
+
+void
+Route::disable_plugins ()
+{
+ Glib::RWLock::ReaderLock lm (_processor_lock);
+
+ for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
+ if (boost::dynamic_pointer_cast<PluginInsert> (*i)) {
+ (*i)->set_active (false);
+ }
+ }
+
+ _session.set_dirty ();
+}
+
+
+void
+Route::ab_plugins (bool forward)
+{
+ Glib::RWLock::ReaderLock lm (_processor_lock);
+
+ if (forward) {
+
+ /* forward = turn off all active redirects, and mark them so that the next time
+ we go the other way, we will revert them
+ */
+
+ for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
+ if (!boost::dynamic_pointer_cast<PluginInsert> (*i)) {
+ continue;
+ }
+
+ if ((*i)->active()) {
+ (*i)->set_active (false);
+ (*i)->set_next_ab_is_active (true);
+ } else {
+ (*i)->set_next_ab_is_active (false);
+ }
+ }
+
+ } else {
+
+ /* backward = if the redirect was marked to go active on the next ab, do so */
+
+ for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
+
+ if (!boost::dynamic_pointer_cast<PluginInsert> (*i)) {
+ continue;
+ }
+
+ if ((*i)->get_next_ab_is_active()) {
+ (*i)->set_active (true);
+ } else {
+ (*i)->set_active (false);
+ }
+ }
+ }
+
+ _session.set_dirty ();
+}
+
+
+/* Figure out the streams that will feed into PreFader */
+ChanCount
+Route::pre_fader_streams() const
+{
+ boost::shared_ptr<Processor> processor;
+
+ // Find the last pre-fader redirect
+ for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) {
+ if ((*i)->placement() == PreFader) {
+ processor = *i;
+ }
+ }
+
+ if (processor) {
+ return processor->output_streams();
+ } else {
+ return n_inputs ();
+ }
+}
+
+
+/** Remove processors with a given placement.
+ * @param p Placement of processors to remove.
+ */
+void
+Route::clear_processors (Placement p)
+{
+ const ChanCount old_rmo = processor_max_outs;