summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-03-08 17:24:53 +0100
committerRobin Gareus <robin@gareus.org>2015-03-08 19:02:31 +0100
commitf89123b28b38cf51193e3dce0bbf9f88fe8de868 (patch)
tree3ab15eb04575919c23cd0332a0e16307dcb05aaf /libs/ardour
parent0f736feee0f98ab7564c206e991fdab0e98af66d (diff)
libardour API to exercise get_port_property
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/port.h3
-rw-r--r--libs/ardour/ardour/port_manager.h1
-rw-r--r--libs/ardour/port.cc20
-rw-r--r--libs/ardour/port_manager.cc17
4 files changed, 41 insertions, 0 deletions
diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h
index 6a05314843..97f8a4e778 100644
--- a/libs/ardour/ardour/port.h
+++ b/libs/ardour/ardour/port.h
@@ -55,6 +55,9 @@ public:
return _name;
}
+ /** @return Port human readable name */
+ std::string pretty_name (bool fallback_to_name = false) const;
+
int set_name (std::string const &);
/** @return flags */
diff --git a/libs/ardour/ardour/port_manager.h b/libs/ardour/ardour/port_manager.h
index b36e98fe64..6ced0e7dd1 100644
--- a/libs/ardour/ardour/port_manager.h
+++ b/libs/ardour/ardour/port_manager.h
@@ -79,6 +79,7 @@ class LIBARDOUR_API PortManager
void port_renamed (const std::string&, const std::string&);
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;
bool port_is_mine (const std::string& fullname) const;
/* other Port management */
diff --git a/libs/ardour/port.cc b/libs/ardour/port.cc
index 8e9db708a8..3252134ac3 100644
--- a/libs/ardour/port.cc
+++ b/libs/ardour/port.cc
@@ -83,6 +83,26 @@ Port::~Port ()
drop ();
}
+
+std::string
+Port::pretty_name(bool fallback_to_name) const
+{
+ if (_port_handle) {
+ std::string value;
+ std::string type;
+ if (0 == port_engine.get_port_property (_port_handle,
+ "http://jackaudio.org/metadata/pretty-name",
+ value, type))
+ {
+ return value;
+ }
+ }
+ if (fallback_to_name) {
+ return name ();
+ }
+ return "";
+}
+
void
Port::drop ()
{
diff --git a/libs/ardour/port_manager.cc b/libs/ardour/port_manager.cc
index a8d8da0067..de78dfd319 100644
--- a/libs/ardour/port_manager.cc
+++ b/libs/ardour/port_manager.cc
@@ -108,6 +108,23 @@ PortManager::make_port_name_non_relative (const string& portname) const
return str;
}
+std::string
+PortManager::get_pretty_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://jackaudio.org/metadata/pretty-name",
+ value, type))
+ {
+ return value;
+ }
+ }
+ return "";
+}
+
bool
PortManager::port_is_mine (const string& portname) const
{