summaryrefslogtreecommitdiff
path: root/libs/midi++2/midimanager.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-07-20 16:05:00 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-07-20 16:05:00 +0000
commitab3020cee102913aa6399d6fb5535e7e55093120 (patch)
tree65d00ee6ff10dc58be876d541b51927481240758 /libs/midi++2/midimanager.cc
parente644ddc4c8efa1b134a61b7a5a7f4112d2e90465 (diff)
permit MIDI port removal now, and save MIDI ports back to the ardour.rc file
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2163 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/midi++2/midimanager.cc')
-rw-r--r--libs/midi++2/midimanager.cc76
1 files changed, 21 insertions, 55 deletions
diff --git a/libs/midi++2/midimanager.cc b/libs/midi++2/midimanager.cc
index 3b7323541d..cc4ca6abec 100644
--- a/libs/midi++2/midimanager.cc
+++ b/libs/midi++2/midimanager.cc
@@ -145,18 +145,32 @@ Manager::add_port (PortRequest &req)
}
int
-Manager::remove_port (string name)
+Manager::remove_port (Port* port)
{
PortMap::iterator res;
- if ((res = ports_by_device.find (name)) == ports_by_device.end()) {
- return -1;
+ for (res = ports_by_device.begin(); res != ports_by_device.end(); ) {
+ PortMap::iterator tmp;
+ tmp = res;
+ ++tmp;
+ if (res->second == port) {
+ ports_by_device.erase (res);
+ }
+ res = tmp;
}
-
- ports_by_device.erase (res);
- ports_by_device.erase ((*res).second->name());
- delete (*res).second;
+
+ for (res = ports_by_tag.begin(); res != ports_by_tag.end(); ) {
+ PortMap::iterator tmp;
+ tmp = res;
+ ++tmp;
+ if (res->second == port) {
+ ports_by_tag.erase (res);
+ }
+ res = tmp;
+ }
+
+ delete port;
return 0;
}
@@ -184,22 +198,6 @@ Manager::set_input_port (string tag)
}
int
-Manager::set_input_port (size_t portnum)
-
-{
- PortMap::iterator res;
-
- for (res = ports_by_tag.begin(); res != ports_by_tag.end(); res++) {
- if ((*res).second->number() == portnum) {
- inputPort = (*res).second;
- return 0;
- }
- }
-
- return -1;
-}
-
-int
Manager::set_output_port (string tag)
{
@@ -231,22 +229,6 @@ Manager::set_output_port (string tag)
return 0;
}
-int
-Manager::set_output_port (size_t portnum)
-
-{
- PortMap::iterator res;
-
- for (res = ports_by_tag.begin(); res != ports_by_tag.end(); res++) {
- if ((*res).second->number() == portnum) {
- outputPort = (*res).second;
- return 0;
- }
- }
-
- return -1;
-}
-
Port *
Manager::port (string name)
{
@@ -261,25 +243,9 @@ Manager::port (string name)
return 0;
}
-Port *
-Manager::port (size_t portnum)
-
-{
- PortMap::iterator res;
-
- for (res = ports_by_tag.begin(); res != ports_by_tag.end(); res++) {
- if ((*res).second->number() == portnum) {
- return (*res).second;
- }
- }
-
- return 0;
-}
-
int
Manager::foreach_port (int (*func)(const Port &, size_t, void *),
void *arg)
-
{
PortMap::const_iterator i;
int retval;