From d4ca31ada80a60a12461245feeb4aa7316a2695a Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 1 Apr 2008 19:08:10 +0000 Subject: [PATCH] clean up port insert port count/config mess, maybe git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3205 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/io_selector.cc | 2 ++ libs/ardour/insert.cc | 30 +++++++++++++----------------- libs/ardour/io.cc | 2 +- libs/ardour/route.cc | 1 + 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/gtk2_ardour/io_selector.cc b/gtk2_ardour/io_selector.cc index b097e8966b..f25bd9be00 100644 --- a/gtk2_ardour/io_selector.cc +++ b/gtk2_ardour/io_selector.cc @@ -214,6 +214,8 @@ IOSelector::IOSelector (Session& sess, boost::shared_ptr ior, bool input) io->output_changed.connect (mem_fun(*this, &IOSelector::ports_changed)); } + set_button_sensitivity (); + io->name_changed.connect (mem_fun(*this, &IOSelector::name_changed)); } diff --git a/libs/ardour/insert.cc b/libs/ardour/insert.cc index f9c20a35d1..ce538fc960 100644 --- a/libs/ardour/insert.cc +++ b/libs/ardour/insert.cc @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -924,15 +925,6 @@ PortInsert::PortInsert (const PortInsert& other) void PortInsert::init () { - if (add_input_port ("", this)) { - error << _("PortInsert: cannot add input port") << endmsg; - throw failed_constructor(); - } - - if (add_output_port ("", this)) { - error << _("PortInsert: cannot add output port") << endmsg; - throw failed_constructor(); - } } PortInsert::PortInsert (Session& s, const XMLNode& node) @@ -1065,7 +1057,7 @@ PortInsert::can_support_input_configuration (int32_t in) const /* not configured yet */ - return 1; /* we can support anything the first time we're asked */ + return in; /* we can support anything the first time we're asked */ } else { @@ -1074,7 +1066,7 @@ PortInsert::can_support_input_configuration (int32_t in) const */ if (output_maximum() == in) { - return 1; + return in; } } @@ -1088,8 +1080,12 @@ PortInsert::configure_io (int32_t ignored_magic, int32_t in, int32_t out) the last request config. or something like that. */ + set_output_maximum (in); + set_output_minimum (in); + set_input_maximum (out); + set_input_minimum (out); - /* this is a bit odd: + /* this can be momentarily confusing: the number of inputs we are required to handle corresponds to the number of output ports we need. @@ -1098,11 +1094,6 @@ PortInsert::configure_io (int32_t ignored_magic, int32_t in, int32_t out) to the number of input ports we need. */ - set_output_maximum (in); - set_output_minimum (in); - set_input_maximum (out); - set_input_minimum (out); - if (in < 0) { in = n_outputs (); } @@ -1117,6 +1108,11 @@ PortInsert::configure_io (int32_t ignored_magic, int32_t in, int32_t out) int32_t PortInsert::compute_output_streams (int32_t cnt) const { + if (n_inputs() == 0) { + /* not configured yet */ + return cnt; + } + /* puzzling, eh? think about it ... */ return n_inputs (); } diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index 3f9a8b29e3..68a4128116 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -954,7 +954,7 @@ IO::add_input_port (string source, void* src, DataType type) { Glib::Mutex::Lock lm (io_lock); - + if (_input_maximum >= 0 && (int) _ninputs == _input_maximum) { return -1; } diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index f63524032d..991b3a5f23 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -24,6 +24,7 @@ #include #include #include +#include #include #include