mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-03 12:19:33 +01:00
Add API to query hardware port name
In case of internal backends this allows to retrieve the Device name for a given (hashed unique) port-name. As opposed to "pretty-name" (which defaults to hw-port-name), this cannot be changed by the user. It is intended to be used when probing for control surfaces.
This commit is contained in:
parent
2bdf51e02d
commit
287a21c09e
3 changed files with 27 additions and 0 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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<BackendPort>(port)->hw_port_name ();
|
||||
if (!value.empty()) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue