From 4ac8e622bb4ef5841435fc0815efb6bb756f76da Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 28 Nov 2020 11:18:08 +0100 Subject: 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. --- src/PatchageEvent.hpp | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'src/PatchageEvent.hpp') 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 -#endif -#ifdef HAVE_ALSA -# include -#endif - #include 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 - 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 - 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) {} -- cgit v1.2.1