diff options
author | Robin Gareus <robin@gareus.org> | 2017-01-21 00:32:15 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-01-21 00:38:43 +0100 |
commit | 7a36ce49256a5aa96084b1f94b4c88bceb083fa5 (patch) | |
tree | 2a031b355f6319e4e7cf50cc5f93d71e0425186a | |
parent | 7960e1ddbfd0af2b9e3a538b67a05266cf0429e6 (diff) |
Instrument insert options:
* allow to directly fan-out when adding a multi-channel instrument
* Mixbus: move multi-channel instruments after Comp & EQ.
-rw-r--r-- | libs/ardour/ardour/plugin_insert.h | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/route.h | 2 | ||||
-rw-r--r-- | libs/ardour/route.cc | 41 | ||||
-rw-r--r-- | libs/ardour/session.cc | 10 |
4 files changed, 53 insertions, 1 deletions
diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index 474df73e41..0f533d9200 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -117,6 +117,7 @@ class LIBARDOUR_API PluginInsert : public Processor bool reset_map (bool emit = true); bool sanitize_maps (); bool check_inplace (); + bool configured () const { return _configured; } // these are ports visible on the outside ChanCount output_streams() const; diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index ea783cadca..3ac2d6dda6 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -279,6 +279,7 @@ public: void ab_plugins (bool forward); void clear_processors (Placement); void all_visible_processors_active (bool); + void move_instrument_down (bool postfader = false); bool strict_io () const { return _strict_io; } bool set_strict_io (bool); @@ -359,6 +360,7 @@ public: /** the processors have changed; the parameter indicates what changed */ PBD::Signal1<void,RouteProcessorChange> processors_changed; + PBD::Signal0<void> fan_out; // used to signal the GUI to fan-out (track-creation) PBD::Signal1<void,void*> record_enable_changed; PBD::Signal0<void> processor_latency_changed; /** the metering point has changed */ diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 4fa9eadff7..411f3dc801 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -905,6 +905,7 @@ int Route::add_processors (const ProcessorList& others, boost::shared_ptr<Processor> before, ProcessorStreams* err) { ProcessorList::iterator loc; + boost::shared_ptr <PluginInsert> fanout; if (before) { loc = find(_processors.begin(), _processors.end(), before); @@ -963,7 +964,8 @@ Route::add_processors (const ProcessorList& others, boost::shared_ptr<Processor> if (flags != None) { boost::optional<int> rv = PluginSetup (shared_from_this (), pi, flags); /* EMIT SIGNAL */ - switch (rv.get_value_or (0)) { + int mode = rv.get_value_or (0); + switch (mode & 3) { case 1: to_skip.push_back (*i); // don't add this one; break; @@ -974,6 +976,9 @@ Route::add_processors (const ProcessorList& others, boost::shared_ptr<Processor> default: break; } + if ((mode & 5) == 4) { + fanout = pi; + } } } @@ -1060,6 +1065,11 @@ Route::add_processors (const ProcessorList& others, boost::shared_ptr<Processor> processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */ set_processor_positions (); + if (fanout && fanout->configured () + && fanout->output_streams().n_audio() > 2 + && boost::dynamic_pointer_cast<PluginInsert> (the_instrument ()) == fanout) { + fan_out (); /* EMIT SIGNAL */ + } return 0; } @@ -1970,6 +1980,35 @@ Route::apply_processor_order (const ProcessorList& new_order) maybe_note_meter_position (); } +void +Route::move_instrument_down (bool postfader) +{ + Glib::Threads::RWLock::ReaderLock lm (_processor_lock); + ProcessorList new_order; + boost::shared_ptr<Processor> instrument; + for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) { + boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert>(*i); + if (pi && pi->plugin ()->get_info ()->is_instrument ()) { + instrument = *i; + } else if (instrument && *i == _amp) { + if (postfader) { + new_order.push_back (*i); + new_order.push_back (instrument); + } else { + new_order.push_back (instrument); + new_order.push_back (*i); + } + } else { + new_order.push_back (*i); + } + } + if (!instrument) { + return; + } + lm.release (); + reorder_processors (new_order, 0); +} + int Route::reorder_processors (const ProcessorList& new_order, ProcessorStreams* err) { diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 256100aab4..24a531b424 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -2574,7 +2574,12 @@ Session::new_midi_track (const ChanCount& input, const ChanCount& output, bool s if (strict_io) { pi->set_strict_io (true); } + (*r)->add_processor (pi, PreFader); + + if (Profile->get_mixbus () && pi->configured () && pi->output_streams().n_audio() > 2) { + (*r)->move_instrument_down (false); + } } } } @@ -2669,7 +2674,12 @@ Session::new_midi_route (RouteGroup* route_group, uint32_t how_many, string name if (strict_io) { pi->set_strict_io (true); } + (*r)->add_processor (pi, PreFader); + + if (Profile->get_mixbus () && pi->configured () && pi->output_streams().n_audio() > 2) { + (*r)->move_instrument_down (false); + } } } } |