summaryrefslogtreecommitdiff
path: root/libs/ardour/io.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-04-17 21:50:13 +0200
committerRobin Gareus <robin@gareus.org>2016-04-17 21:50:13 +0200
commitcb09b0b34e6382bcd403526e8501b62d609fed39 (patch)
tree0e325d3081b7e4167ba0dbbd7df45718092ba534 /libs/ardour/io.cc
parent81faa3b420303eec2ca0e3a10e188ac948464099 (diff)
add IOProcessors pretty name support
Diffstat (limited to 'libs/ardour/io.cc')
-rw-r--r--libs/ardour/io.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index 79ee78d8a5..3bbe34f825 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -368,6 +368,7 @@ IO::add_port (string destination, void* src, DataType type)
}
}
+ apply_pretty_name ();
setup_bundle ();
_session.set_dirty ();
@@ -535,6 +536,10 @@ IO::state (bool /*full_state*/)
node->add_property ("direction", enum_2_string (_direction));
node->add_property ("default-type", _default_type.to_string());
+ if (!_pretty_name_prefix.empty ()) {
+ node->add_property("pretty-name", _pretty_name_prefix);
+ }
+
for (std::vector<UserBundleInfo*>::iterator i = _bundles_connected.begin(); i != _bundles_connected.end(); ++i) {
XMLNode* n = new XMLNode ("Bundle");
n->add_property ("name", (*i)->bundle->name ());
@@ -619,6 +624,11 @@ IO::set_state (const XMLNode& node, int version)
return -1;
}
+ // after create_ports, updates names
+ if ((prop = node.property ("pretty-name")) != 0) {
+ set_pretty_name (prop->value());
+ }
+
if (connecting_legal) {
if (make_connections (node, version, false)) {
@@ -1220,6 +1230,31 @@ IO::set_name (const string& requested_name)
return r;
}
+void
+IO::set_pretty_name (const std::string& str)
+{
+ if (_pretty_name_prefix == str) {
+ return;
+ }
+ _pretty_name_prefix = str;
+ apply_pretty_name ();
+}
+
+void
+IO::apply_pretty_name ()
+{
+ uint32_t pn = 1;
+ if (_pretty_name_prefix.empty ()) {
+ return;
+ }
+ for (PortSet::iterator i = _ports.begin (); i != _ports.end(); ++i, ++pn) {
+ (*i)->set_pretty_name (string_compose (("%1/%2 %3"),
+ _pretty_name_prefix,
+ _direction == Output ? _("Out") : _("In"),
+ pn));
+ }
+}
+
framecnt_t
IO::latency () const
{