diff options
author | David Robillard <d@drobilla.net> | 2006-11-19 16:45:16 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-11-19 16:45:16 +0000 |
commit | ef6b25432d9c46d71b08c0f7d5f2686df428c4e8 (patch) | |
tree | 9b30d87b6670aadce365c9b112321dd674a0bab4 /libs/midi++2/midimanager.cc | |
parent | af105afe6cde5b0088647cea7d5e4e3314f8478b (diff) |
Merged with trunk R1141
git-svn-id: svn://localhost/ardour2/branches/midi@1142 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/midi++2/midimanager.cc')
-rw-r--r-- | libs/midi++2/midimanager.cc | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/libs/midi++2/midimanager.cc b/libs/midi++2/midimanager.cc index bfe8f147b6..970674232d 100644 --- a/libs/midi++2/midimanager.cc +++ b/libs/midi++2/midimanager.cc @@ -66,41 +66,43 @@ Manager::add_port (PortRequest &req) PortMap::iterator existing; pair<string, Port *> newpair; - if ((existing = ports_by_device.find (req.devname)) != - ports_by_device.end()) { - - port = (*existing).second; - if (port->mode() == req.mode) { + if (!PortFactory::ignore_duplicate_devices (req.type)) { + + if ((existing = ports_by_device.find (req.devname)) != ports_by_device.end()) { + + port = (*existing).second; + + if (port->mode() == req.mode) { + + /* Same mode - reuse the port, and just + create a new tag entry. + */ + + newpair.first = req.tagname; + newpair.second = port; + + ports_by_tag.insert (newpair); + return port; + } - /* Same mode - reuse the port, and just - create a new tag entry. + /* If the existing is duplex, and this request + is not, then fail, because most drivers won't + allow opening twice with duplex and non-duplex + operation. */ - - newpair.first = req.tagname; - newpair.second = port; - - ports_by_tag.insert (newpair); - return port; - } - - /* If the existing is duplex, and this request - is not, then fail, because most drivers won't - allow opening twice with duplex and non-duplex - operation. - */ - - if ((req.mode == O_RDWR && port->mode() != O_RDWR) || - (req.mode != O_RDWR && port->mode() == O_RDWR)) { - error << "MIDIManager: port tagged \"" - << req.tagname - << "\" cannot be opened duplex and non-duplex" - << endmsg; - return 0; + + if ((req.mode == O_RDWR && port->mode() != O_RDWR) || + (req.mode != O_RDWR && port->mode() == O_RDWR)) { + error << "MIDIManager: port tagged \"" + << req.tagname + << "\" cannot be opened duplex and non-duplex" + << endmsg; + return 0; + } + + /* modes must be different or complementary */ } - - /* modes must be different or complementary */ } - port = factory.create_port (req, api_data); if (port == 0) { |