summaryrefslogtreecommitdiffstats
path: root/src/PatchageEvent.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-06-08 02:17:40 +0000
committerDavid Robillard <d@drobilla.net>2007-06-08 02:17:40 +0000
commitc335e2b88b051a1a14b0806ffabb257c2a0d0e74 (patch)
treeb0a024b901f20254b3354cb7bb03f581b435c245 /src/PatchageEvent.h
parent5a2358e39602607757fedd08a7355bede3cb8739 (diff)
downloadpatchage-c335e2b88b051a1a14b0806ffabb257c2a0d0e74.tar.gz
patchage-c335e2b88b051a1a14b0806ffabb257c2a0d0e74.tar.bz2
patchage-c335e2b88b051a1a14b0806ffabb257c2a0d0e74.zip
Monitor/change ALSA connections without refreshing entire canvas (much faster).
Waiting on JACK to provide the notification to do the same.... git-svn-id: http://svn.drobilla.net/lad/patchage@531 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/PatchageEvent.h')
-rw-r--r--src/PatchageEvent.h43
1 files changed, 38 insertions, 5 deletions
diff --git a/src/PatchageEvent.h b/src/PatchageEvent.h
index a5109ee..da2526b 100644
--- a/src/PatchageEvent.h
+++ b/src/PatchageEvent.h
@@ -20,6 +20,8 @@
#include <string>
#include <jack/jack.h>
+#include "../config.h"
+#include "PatchagePort.h"
class Patchage;
@@ -31,7 +33,9 @@ public:
enum Type {
NULL_EVENT,
PORT_CREATION,
- PORT_DESTRUCTION
+ PORT_DESTRUCTION,
+ CONNECTION,
+ DISCONNECTION
};
PatchageEvent(Patchage* patchage)
@@ -39,21 +43,50 @@ public:
, _type(NULL_EVENT)
{}
- PatchageEvent(Patchage* patchage, Type type, jack_port_id_t port_id)
+ PatchageEvent(Patchage* patchage, Type type, jack_port_id_t port)
: _patchage(patchage)
, _type(type)
- , _port_id(port_id)
+ , _port_1(port)
+ {}
+
+ PatchageEvent(Patchage* patchage, Type type,
+ snd_seq_addr_t port_1, snd_seq_addr_t port_2)
+ : _patchage(patchage)
+ , _type(type)
+ , _port_1(port_1)
+ , _port_2(port_2)
{}
void execute();
Type type() { return _type; }
- jack_port_id_t port_id() { return _port_id; }
private:
Patchage* _patchage;
Type _type;
- jack_port_id_t _port_id;
+
+ struct PortRef {
+ PortRef() : type((PortType)0xdeadbeef) { id.jack = 0; }
+
+ PortRef(jack_port_id_t jack_id) : type(JACK_ANY) { id.jack = jack_id; }
+
+#ifdef HAVE_ALSA
+ PortRef(snd_seq_addr_t addr) : type(ALSA_MIDI) { id.alsa = addr; }
+#endif
+
+ PortType type;
+ union {
+ jack_port_id_t jack;
+#ifdef HAVE_ALSA
+ snd_seq_addr_t alsa;
+#endif
+ } id;
+ };
+
+ PortRef _port_1;
+ PortRef _port_2;
+
+ boost::shared_ptr<PatchagePort> find_port(const PortRef& ref);
};