summaryrefslogtreecommitdiff
path: root/libs/midi++2
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2006-11-17 16:14:44 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2006-11-17 16:14:44 +0000
commit5f37d769351d03acfa6e1704fb9f54fcf57c3c60 (patch)
treea113b60b3c020c03131b9a9ad82965ef374ca16b /libs/midi++2
parent98d93c221a8bd45d90369ff1b52e3f43dad35233 (diff)
fixes for MIDI port setup; options editor now sets trace options correctly (still not saved); MTC now sent immediately after asking for it, not after first stop; add svn_revision.h to avoid compile errors
git-svn-id: svn://localhost/ardour2/trunk@1138 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/midi++2')
-rw-r--r--libs/midi++2/midi++/factory.h5
-rw-r--r--libs/midi++2/midifactory.cc30
-rw-r--r--libs/midi++2/midimanager.cc64
3 files changed, 54 insertions, 45 deletions
diff --git a/libs/midi++2/midi++/factory.h b/libs/midi++2/midi++/factory.h
index 7b4122d791..b532e6d5e6 100644
--- a/libs/midi++2/midi++/factory.h
+++ b/libs/midi++2/midi++/factory.h
@@ -30,9 +30,8 @@ namespace MIDI {
class PortFactory {
public:
Port *create_port (PortRequest &req);
-
- static void add_port_request (std::vector<PortRequest *> &reqs,
- const std::string &reqstr);
+
+ static bool ignore_duplicate_devices (Port::Type);
};
} // namespace MIDI
diff --git a/libs/midi++2/midifactory.cc b/libs/midi++2/midifactory.cc
index 38baada204..0a86c94cb9 100644
--- a/libs/midi++2/midifactory.cc
+++ b/libs/midi++2/midifactory.cc
@@ -76,20 +76,28 @@ PortFactory::create_port (PortRequest &req)
return port;
}
-void
-PortFactory::add_port_request (vector<PortRequest *> &reqs,
- const string &str)
-
+bool
+PortFactory::ignore_duplicate_devices (Port::Type type)
{
- PortRequest *req;
+ bool ret = false;
- req = new PortRequest;
- req->devname = strdup (str.c_str());
- req->tagname = strdup (str.c_str());
+ switch (type) {
+#ifdef WITH_ALSA
+ case Port::ALSA_Sequencer:
+ ret = true;
+ break;
+#endif // WITH_ALSA
- req->mode = O_RDWR;
- req->type = Port::ALSA_RawMidi;
+#if WITH_COREMIDI
+ case Port::CoreMidi_MidiPort:
+ ret = true;
+ break;
+#endif // WITH_COREMIDI
+
+ default:
+ break;
+ }
- reqs.push_back (req);
+ return ret;
}
diff --git a/libs/midi++2/midimanager.cc b/libs/midi++2/midimanager.cc
index e25a2737ba..44fd89108c 100644
--- a/libs/midi++2/midimanager.cc
+++ b/libs/midi++2/midimanager.cc
@@ -72,41 +72,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);