Check that adding a port to an IO is ok with the processors

in its route, and raise an error if not (part of #4535).


git-svn-id: svn://localhost/ardour2/branches/3.0@10938 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington
2011-12-07 17:50:56 +00:00
parent ff7785142d
commit 5700d10890
2 changed files with 18 additions and 1 deletions

View File

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

View File

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