diff options
author | David Robillard <d@drobilla.net> | 2006-08-31 01:06:37 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-08-31 01:06:37 +0000 |
commit | 5a401620266dd832b120235c8e956a86d1f800cd (patch) | |
tree | 6067cead1e9e32aa276b1bccaa8f121a8007ed1d /libs/ardour/port_set.cc | |
parent | 82232f06ba3eea4a2b4342ad91fab552f4044402 (diff) |
- Fixed port adding/removing/connecting and related bugs with route signal path
- Minor MIDI bug fixes/cleanups
git-svn-id: svn://localhost/ardour2/branches/midi@874 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/port_set.cc')
-rw-r--r-- | libs/ardour/port_set.cc | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/libs/ardour/port_set.cc b/libs/ardour/port_set.cc index 3d6ab8c537..388162359b 100644 --- a/libs/ardour/port_set.cc +++ b/libs/ardour/port_set.cc @@ -32,7 +32,7 @@ static bool sort_ports_by_name (Port* a, Port* b) } void -PortSet::add_port(Port* port) +PortSet::add(Port* port) { const size_t list_index = port->type().to_index(); assert(list_index < _ports.size()); @@ -47,6 +47,20 @@ PortSet::add_port(Port* port) assert(_count.get(port->type()) == _ports[port->type().to_index()].size()); } +bool +PortSet::remove(Port* port) +{ + for (std::vector<PortVec>::iterator l = _ports.begin(); l != _ports.end(); ++l) { + PortVec::iterator i = find(l->begin(), l->end(), port); + if (i != l->end()) { + l->erase(i); + _count.set(port->type(), _count.get(port->type()) - 1); + return true; + } + } + + return false; +} /** Get the total number of ports (of all types) in the PortSet */ @@ -74,7 +88,7 @@ PortSet::contains(const Port* port) const Port* PortSet::port(size_t n) const { - // This is awesome + // This is awesome. Awesomely slow. size_t size_so_far = 0; |