summaryrefslogtreecommitdiff
path: root/libs/ardour/route.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/route.cc')
-rw-r--r--libs/ardour/route.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index bb25c1f9b0..232f295df6 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -98,6 +98,7 @@ Route::Route (Session& sess, string name, Flag flg, DataType default_type)
, _default_type (default_type)
, _remote_control_id (0)
, _in_configure_processors (false)
+ , _initial_io_setup (false)
, _custom_meter_position_noted (false)
, _last_custom_meter_was_at_end (false)
{
@@ -136,6 +137,7 @@ Route::init ()
_input->PortCountChanging.connect_same_thread (*this, boost::bind (&Route::input_port_count_changing, this, _1));
_output->changed.connect_same_thread (*this, boost::bind (&Route::output_change_handler, this, _1, _2));
+ _output->PortCountChanging.connect_same_thread (*this, boost::bind (&Route::output_port_count_changing, this, _1));
/* add amp processor */
@@ -1708,6 +1710,9 @@ Route::configure_processors_unlocked (ProcessorStreams* err)
}
ChanCount out;
+ bool seen_mains_out = false;
+ processor_out_streams = _input->n_ports();
+ processor_max_streams.reset();
list< pair<ChanCount,ChanCount> >::iterator c = configuration.begin();
for (ProcessorList::iterator p = _processors.begin(); p != _processors.end(); ++p, ++c) {
@@ -1720,8 +1725,21 @@ Route::configure_processors_unlocked (ProcessorStreams* err)
processor_max_streams = ChanCount::max(processor_max_streams, c->first);
processor_max_streams = ChanCount::max(processor_max_streams, c->second);
out = c->second;
+
+ if (boost::dynamic_pointer_cast<Delivery> (*p)
+ && boost::dynamic_pointer_cast<Delivery> (*p)->role() == Delivery::Main) {
+ /* main delivery will increase port count to match input.
+ * the Delivery::Main is usually the last processor - followed only by
+ * 'MeterOutput'.
+ */
+ seen_mains_out = true;
+ }
+ if (!seen_mains_out) {
+ processor_out_streams = out;
+ }
}
+
if (_meter) {
_meter->reset_max_channels (processor_max_streams);
}
@@ -1999,6 +2017,7 @@ Route::set_state (const XMLNode& node, int version)
}
set_id (node);
+ _initial_io_setup = true;
if ((prop = node.property (X_("flags"))) != 0) {
_flags = Flag (string_2_enum (prop->value(), _flags));
@@ -2066,6 +2085,8 @@ Route::set_state (const XMLNode& node, int version)
_meter_type = MeterType (string_2_enum (prop->value (), _meter_type));
}
+ _initial_io_setup = false;
+
set_processor_state (processor_state);
// this looks up the internal instrument in processors
@@ -2946,6 +2967,9 @@ void
Route::output_change_handler (IOChange change, void * /*src*/)
{
bool need_to_queue_solo_change = true;
+ if (_initial_io_setup) {
+ return;
+ }
if ((change.type & IOChange::ConfigurationChanged)) {
/* This is called with the process lock held if change
@@ -3758,6 +3782,19 @@ Route::input_port_count_changing (ChanCount to)
return false;
}
+/** Called when there is a proposed change to the output port count */
+bool
+Route::output_port_count_changing (ChanCount to)
+{
+ for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
+ if (processor_out_streams.get(*t) > to.get(*t)) {
+ return true;
+ }
+ }
+ /* The change is ok */
+ return false;
+}
+
list<string>
Route::unknown_processors () const
{