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/JackDbusDriver.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/JackDbusDriver.cpp') diff --git a/src/JackDbusDriver.cpp b/src/JackDbusDriver.cpp index 2ec3dd1..7d3a532 100644 --- a/src/JackDbusDriver.cpp +++ b/src/JackDbusDriver.cpp @@ -54,6 +54,16 @@ PATCHAGE_RESTORE_WARNINGS //#define USE_FULL_REFRESH +namespace { + +std::string +full_name(const std::string& client_name, const std::string& port_name) +{ + return client_name + ":" + port_name; +} + +} // namespace + JackDriver::JackDriver(Patchage* app, ILog& log) : _app(app) , _log(log) @@ -600,7 +610,7 @@ JackDriver::add_port(PatchageModule* module, new PatchagePort(*module, type, - id, + std::move(id), name, "", // TODO: pretty name is_input, @@ -611,7 +621,7 @@ JackDriver::add_port(PatchageModule* module, void JackDriver::add_port(dbus_uint64_t /*client_id*/, const char* client_name, - dbus_uint64_t port_id, + dbus_uint64_t /*port_id*/, const char* port_name, dbus_uint32_t port_flags, dbus_uint32_t port_type) @@ -644,7 +654,7 @@ JackDriver::add_port(dbus_uint64_t /*client_id*/, add_port(module, local_port_type, - PortID{static_cast(port_id), false}, + PortID::jack(full_name(client_name, port_name)), port_name, port_flags & JACKDBUS_PORT_FLAG_INPUT); } -- cgit v1.2.1