summaryrefslogtreecommitdiffstats
path: root/src/client/NodeModel.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-02-18 16:33:28 +0000
committerDavid Robillard <d@drobilla.net>2011-02-18 16:33:28 +0000
commit8e07e115429a0869593d4f29dc3e6cf5c8b25049 (patch)
tree68cfdc5ee4a1c932d05ee8988f2738f31c119218 /src/client/NodeModel.cpp
parent7ef2c6553339a3c38f8784d764a8f2610bde5d89 (diff)
downloadingen-8e07e115429a0869593d4f29dc3e6cf5c8b25049.tar.gz
ingen-8e07e115429a0869593d4f29dc3e6cf5c8b25049.tar.bz2
ingen-8e07e115429a0869593d4f29dc3e6cf5c8b25049.zip
Use port name from SLV2 for labels where possible (fix ticket #636).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2991 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/client/NodeModel.cpp')
-rw-r--r--src/client/NodeModel.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/client/NodeModel.cpp b/src/client/NodeModel.cpp
index 2ffd751d..1ff3cae6 100644
--- a/src/client/NodeModel.cpp
+++ b/src/client/NodeModel.cpp
@@ -221,6 +221,33 @@ NodeModel::port_value_range(SharedPtr<PortModel> port, float& min, float& max) c
}
+std::string
+NodeModel::port_label(SharedPtr<PortModel> port) const
+{
+ const Raul::Atom& name = port->get_property("http://lv2plug.in/ns/lv2core#name");
+ if (name.is_valid()) {
+ return name.get_string();
+ }
+
+#ifdef HAVE_SLV2
+ if (_plugin && _plugin->type() == PluginModel::LV2) {
+ SLV2World c_world = _plugin->slv2_world();
+ SLV2Plugin c_plugin = _plugin->slv2_plugin();
+ SLV2Value c_sym = slv2_value_new_string(c_world, port->symbol().c_str());
+ SLV2Port c_port = slv2_plugin_get_port_by_symbol(c_plugin, c_sym);
+ if (c_port) {
+ SLV2Value c_name = slv2_port_get_name(c_plugin, c_port);
+ if (c_name && slv2_value_is_string(c_name)) {
+ return slv2_value_as_string(c_name);
+ }
+ }
+ }
+#endif
+
+ return port->symbol().c_str();
+}
+
+
void
NodeModel::set(SharedPtr<ObjectModel> model)
{