summaryrefslogtreecommitdiffstats
path: root/src/PortID.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-12-14 20:47:05 +0000
committerDavid Robillard <d@drobilla.net>2010-12-14 20:47:05 +0000
commit5a260f5e574ad8e33cd5528c214b4a25b18e248e (patch)
tree1b02ea3f4e50677ff9cf6086ffc8062f9cab7279 /src/PortID.hpp
parentd9a54049e99f6c3963e1f48e04b9a7adcd81899b (diff)
downloadpatchage-5a260f5e574ad8e33cd5528c214b4a25b18e248e.tar.gz
patchage-5a260f5e574ad8e33cd5528c214b4a25b18e248e.tar.bz2
patchage-5a260f5e574ad8e33cd5528c214b4a25b18e248e.zip
Better error messages.
git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@2685 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/PortID.hpp')
-rw-r--r--src/PortID.hpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/PortID.hpp b/src/PortID.hpp
index c221a0a..82a892a 100644
--- a/src/PortID.hpp
+++ b/src/PortID.hpp
@@ -20,6 +20,7 @@
#include "patchage-config.h"
+#include <iostream>
#include <cstring>
#ifdef USE_LIBJACK
#include <jack/jack.h>
@@ -60,5 +61,25 @@ struct PortID {
} id;
};
+static inline std::ostream&
+operator<<(std::ostream& os, const PortID& id)
+{
+ switch (id.type) {
+ case PortID::NULL_PORT_ID:
+ return os << "(null)";
+ case PortID::JACK_ID:
+#ifdef USE_LIBJACK
+ return os << "jack:" << id.id.jack_id;
+#endif
+ break;
+ case PortID::ALSA_ADDR:
+#ifdef HAVE_ALSA
+ return os << "alsa:" << (int)id.id.alsa_addr.client << ":" << (int)id.id.alsa_addr.port;
+#endif
+ break;
+ }
+ assert(false);
+}
+
#endif // PATCHAGE_PORTID_HPP