diff options
author | David Robillard <d@drobilla.net> | 2020-11-28 11:18:08 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-11-28 12:45:57 +0100 |
commit | 4ac8e622bb4ef5841435fc0815efb6bb756f76da (patch) | |
tree | 156fed5580687bca59fed337c9701acbcaf469f5 /src/PatchageEvent.hpp | |
parent | 4988d75f19e81c58e2cfdc068c5638b95ae9e314 (diff) | |
download | patchage-4ac8e622bb4ef5841435fc0815efb6bb756f76da.tar.gz patchage-4ac8e622bb4ef5841435fc0815efb6bb756f76da.tar.bz2 patchage-4ac8e622bb4ef5841435fc0815efb6bb756f76da.zip |
Always index Jack ports and refer to them by name
The Jack API annoyingly doesn't provide a way to get an ID from a port name.
Since notification callbacks apparently don't have to worry about realtime
concerns anymore, simply use the full name string as an ID everywhere.
This means that every Jack port has a non-null ID, and all ports are always
indexed, so the kludges for this in the canvas can be removed.
Diffstat (limited to 'src/PatchageEvent.hpp')
-rw-r--r-- | src/PatchageEvent.hpp | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/src/PatchageEvent.hpp b/src/PatchageEvent.hpp index 2bb239a..dca4dbd 100644 --- a/src/PatchageEvent.hpp +++ b/src/PatchageEvent.hpp @@ -22,19 +22,11 @@ #include "PatchagePort.hpp" #include "PortID.hpp" -#ifdef PATCHAGE_LIBJACK -# include <jack/jack.h> -#endif -#ifdef HAVE_ALSA -# include <alsa/asoundlib.h> -#endif - #include <cstring> class Patchage; -/** A Driver event to be processed by the GUI thread. - */ +/// An event from drivers that is processed by the GUI class PatchageEvent { public: @@ -50,25 +42,22 @@ public: disconnection, }; - explicit PatchageEvent(Type type = Type::noop) - : _type(type) - {} - PatchageEvent(Type type, const char* str) : _str(g_strdup(str)) + , _port_1(PortID::nothing()) + , _port_2(PortID::nothing()) , _type(type) {} - template<typename P> - PatchageEvent(Type type, P port) - : _port_1(port) + PatchageEvent(Type type, PortID port) + : _port_1(std::move(port)) + , _port_2(PortID::nothing()) , _type(type) {} - template<typename P> - PatchageEvent(Type type, P port_1, P port_2) - : _port_1(port_1, false) - , _port_2(port_2, true) + PatchageEvent(Type type, PortID tail, PortID head) + : _port_1(std::move(tail)) + , _port_2(std::move(head)) , _type(type) {} |