diff options
Diffstat (limited to 'libs/ardour/io.cc')
-rw-r--r-- | libs/ardour/io.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index c6624b2e4a..52bbd59b5f 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -200,6 +200,19 @@ IO::connect (boost::shared_ptr<Port> our_port, string other_port, void* src) return 0; } +bool +IO::can_add_port (DataType type) const +{ + switch (type) { + case DataType::NIL: + return false; + case DataType::AUDIO: + return true; + case DataType::MIDI: + return _ports.count ().n_midi() < 1; + } +} + int IO::remove_port (boost::shared_ptr<Port> port, void* src) { @@ -269,6 +282,10 @@ IO::add_port (string destination, void* src, DataType type) type = _default_type; } + if (!can_add_port (type)) { + return -1; + } + ChanCount before = _ports.count (); ChanCount after = before; after.set (type, after.get (type) + 1); |