From eede1a188c2da2c926d49902f2b2c411774342af Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 7 Sep 2008 20:16:49 +0000 Subject: Separate PortRef (now PortID) from PatchageEvent. git-svn-id: http://svn.drobilla.net/lad/patchage@1477 a436a847-0d15-0410-975c-d299462d15a1 --- src/PortID.hpp | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/PortID.hpp (limited to 'src/PortID.hpp') 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 + * + * 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 +#ifdef HAVE_JACK +#include +#endif +#ifdef HAVE_ALSA +#include +#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 + -- cgit v1.2.1