summaryrefslogtreecommitdiffstats
path: root/src/PortID.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-09-07 20:16:49 +0000
committerDavid Robillard <d@drobilla.net>2008-09-07 20:16:49 +0000
commiteede1a188c2da2c926d49902f2b2c411774342af (patch)
tree6dfa7861c5bf21c1db5175e88249d28027bb16a7 /src/PortID.hpp
parent19b035f0f0a78d5906664e3080ff467413f20ec2 (diff)
downloadpatchage-eede1a188c2da2c926d49902f2b2c411774342af.tar.gz
patchage-eede1a188c2da2c926d49902f2b2c411774342af.tar.bz2
patchage-eede1a188c2da2c926d49902f2b2c411774342af.zip
Separate PortRef (now PortID) from PatchageEvent.
git-svn-id: http://svn.drobilla.net/lad/patchage@1477 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/PortID.hpp')
-rw-r--r--src/PortID.hpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/PortID.hpp b/src/PortID.hpp
new file mode 100644
index 0000000..330e6c0
--- /dev/null
+++ b/src/PortID.hpp
@@ -0,0 +1,61 @@
+/* This file is part of Patchage.
+ * Copyright (C) 2008 Dave Robillard <http://drobilla.net>
+ *
+ * Patchage is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * Patchage is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef PATCHAGE_PORTID_HPP
+#define PATCHAGE_PORTID_HPP
+
+#include CONFIG_H_PATH
+
+#include <cstring>
+#ifdef HAVE_JACK
+#include <jack/jack.h>
+#endif
+#ifdef HAVE_ALSA
+#include <alsa/asoundlib.h>
+#endif
+
+#include "PatchagePort.hpp"
+
+struct PortID {
+ PortID() : type(NULL_PORT_ID) { memset(&id, 0, sizeof(id)); }
+
+ enum { NULL_PORT_ID, JACK_ID, ALSA_ADDR } type;
+
+#ifdef HAVE_JACK
+ PortID(jack_port_id_t jack_id, bool ign=false)
+ : type(JACK_ID) { id.jack_id = jack_id; }
+#endif
+
+#ifdef HAVE_ALSA
+ PortID(snd_seq_addr_t addr, bool in)
+ : type(ALSA_ADDR) { id.alsa_addr = addr; is_input = in; }
+
+ bool is_input;
+#endif
+
+ union {
+#ifdef HAVE_JACK
+ jack_port_id_t jack_id;
+#endif
+#ifdef HAVE_ALSA
+ snd_seq_addr_t alsa_addr;
+#endif
+ } id;
+};
+
+#endif // PATCHAGE_PORTID_HPP
+