summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/port_matrix.cc10
-rw-r--r--libs/ardour/io.cc9
2 files changed, 18 insertions, 1 deletions
diff --git a/gtk2_ardour/port_matrix.cc b/gtk2_ardour/port_matrix.cc
index 576b8789ca..8bdc1c4cc0 100644
--- a/gtk2_ardour/port_matrix.cc
+++ b/gtk2_ardour/port_matrix.cc
@@ -26,6 +26,7 @@
#include <gtkmm/menu_elems.h>
#include <gtkmm/window.h>
#include <gtkmm/stock.h>
+#include <gtkmm/messagedialog.h>
#include "ardour/bundle.h"
#include "ardour/types.h"
#include "ardour/session.h"
@@ -684,7 +685,14 @@ PortMatrix::add_channel (boost::shared_ptr<Bundle> b, DataType t)
boost::shared_ptr<IO> io = io_from_bundle (b);
if (io) {
- io->add_port ("", this, t);
+ int const r = io->add_port ("", this, t);
+ if (r == -1) {
+ Gtk::MessageDialog msg (_("It is not possible to add a port here, as the first processor in the track or buss cannot "
+ "support the new configuration."
+ ));
+ msg.set_title (_("Cannot add port"));
+ msg.run ();
+ }
}
}
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index 23c7594d40..c5f0c7361d 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -292,6 +292,15 @@ IO::add_port (string destination, void* src, DataType type)
type = _default_type;
}
+ ChanCount before = _ports.count ();
+ ChanCount after = before;
+ after.set (type, after.get (type) + 1);
+
+ bool const r = PortCountChanging (after); /* EMIT SIGNAL */
+ if (r) {
+ return -1;
+ }
+
IOChange change;
{