13
0

add IOProcessors pretty name support

This commit is contained in:
Robin Gareus 2016-04-17 21:50:13 +02:00
parent 81faa3b420
commit cb09b0b34e
2 changed files with 39 additions and 0 deletions

View File

@ -88,6 +88,8 @@ class LIBARDOUR_API IO : public SessionObject, public Latent
void set_active(bool yn) { _active = yn; }
bool set_name (const std::string& str);
void set_pretty_name (const std::string& str);
std::string pretty_name () const { return _pretty_name_prefix; }
virtual void silence (framecnt_t);
void increment_port_buffer_offset (pframes_t offset);
@ -248,6 +250,8 @@ class LIBARDOUR_API IO : public SessionObject, public Latent
void setup_bundle ();
std::string bundle_channel_name (uint32_t, uint32_t, DataType) const;
void apply_pretty_name ();
std::string _pretty_name_prefix;
BufferSet _buffers;
void disconnect_check (boost::shared_ptr<ARDOUR::Port>, boost::shared_ptr<ARDOUR::Port>);
};

View File

@ -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
{