summaryrefslogtreecommitdiffstats
path: root/src/JackDbusDriver.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-11-28 11:18:08 +0100
committerDavid Robillard <d@drobilla.net>2020-11-28 12:45:57 +0100
commit4ac8e622bb4ef5841435fc0815efb6bb756f76da (patch)
tree156fed5580687bca59fed337c9701acbcaf469f5 /src/JackDbusDriver.cpp
parent4988d75f19e81c58e2cfdc068c5638b95ae9e314 (diff)
downloadpatchage-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/JackDbusDriver.cpp')
-rw-r--r--src/JackDbusDriver.cpp16
1 files changed, 13 insertions, 3 deletions
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<jack_port_id_t>(port_id), false},
+ PortID::jack(full_name(client_name, port_name)),
port_name,
port_flags & JACKDBUS_PORT_FLAG_INPUT);
}