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/PatchageCanvas.cpp | |
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/PatchageCanvas.cpp')
-rw-r--r-- | src/PatchageCanvas.cpp | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/src/PatchageCanvas.cpp b/src/PatchageCanvas.cpp index 16a85ef..1433244 100644 --- a/src/PatchageCanvas.cpp +++ b/src/PatchageCanvas.cpp @@ -85,44 +85,13 @@ PatchageCanvas::remove_module(const std::string& name) PatchagePort* PatchageCanvas::find_port(const PortID& id) { - PatchagePort* pp = nullptr; - auto i = _port_index.find(id); if (i != _port_index.end()) { assert(i->second->get_module()); return i->second; } -#ifdef PATCHAGE_LIBJACK - // Alsa ports are always indexed (or don't exist at all) - if (id.type == PortID::Type::jack_id) { - jack_port_t* jack_port = - jack_port_by_id(_app->jack_driver()->client(), id.id.jack_id); - if (!jack_port) { - return nullptr; - } - - std::string module_name; - std::string port_name; - _app->jack_driver()->port_names(id, module_name, port_name); - - PatchageModule* module = - find_module(module_name, - (jack_port_flags(jack_port) & JackPortIsInput) - ? ModuleType::input - : ModuleType::output); - - if (module) { - pp = module->get_port(port_name); - } - - if (pp) { - index_port(id, pp); - } - } -#endif // PATCHAGE_LIBJACK - - return pp; + return nullptr; } void |