13
0

Instrument insert options:

* allow to directly fan-out when adding a multi-channel instrument
 * Mixbus: move multi-channel instruments after Comp & EQ.
This commit is contained in:
Robin Gareus 2017-01-21 00:32:15 +01:00
parent 7960e1ddbf
commit 7a36ce4925
4 changed files with 53 additions and 1 deletions

View File

@ -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;

View File

@ -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 */

View File

@ -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)
{

View File

@ -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);
}
}
}
}