diff --git a/libs/ardour/ardour/port_manager.h b/libs/ardour/ardour/port_manager.h index 7254004395..dd9d53ae21 100644 --- a/libs/ardour/ardour/port_manager.h +++ b/libs/ardour/ardour/port_manager.h @@ -160,6 +160,7 @@ public: std::string make_port_name_relative (const std::string& name) const; std::string make_port_name_non_relative (const std::string& name) const; std::string get_pretty_name_by_name (const std::string& portname) const; + std::string get_hardware_port_name_by_name (const std::string& portname) const; std::string short_port_name_from_port_name (std::string const& full_name) const; bool port_is_mine (const std::string& fullname) const; diff --git a/libs/ardour/port_engine_shared.cc b/libs/ardour/port_engine_shared.cc index bc4494245a..a5bd6b7567 100644 --- a/libs/ardour/port_engine_shared.cc +++ b/libs/ardour/port_engine_shared.cc @@ -616,6 +616,12 @@ PortEngineSharedImpl::get_port_property (PortEngine::PortHandle port, const std: return 0; } } + if (key == "http://ardour.org/metadata/hardware-port-name") { + value = std::static_pointer_cast(port)->hw_port_name (); + if (!value.empty()) { + return 0; + } + } return -1; } diff --git a/libs/ardour/port_manager.cc b/libs/ardour/port_manager.cc index 4c2eed90de..a15fb43b55 100644 --- a/libs/ardour/port_manager.cc +++ b/libs/ardour/port_manager.cc @@ -355,6 +355,26 @@ PortManager::get_pretty_name_by_name (const std::string& portname) const return string (); } +std::string +PortManager::get_hardware_port_name_by_name (const std::string& portname) const +{ + PortEngine::PortHandle ph = _backend->get_port_by_name (portname); + + if (ph) { + std::string value; + std::string type; + if (0 == _backend->get_port_property (ph, "http://ardour.org/metadata/hardware-port-name", value, type)) { + return value; + } else { + return short_port_name_from_port_name (portname); + } + } + + return string (); +} + + + bool PortManager::port_is_mine (const string& portname) const {