summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/NodeModel.cpp27
-rw-r--r--src/client/NodeModel.hpp2
2 files changed, 29 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)
{
diff --git a/src/client/NodeModel.hpp b/src/client/NodeModel.hpp
index fa4af66c..939197b1 100644
--- a/src/client/NodeModel.hpp
+++ b/src/client/NodeModel.hpp
@@ -67,6 +67,8 @@ public:
void default_port_value_range(SharedPtr<PortModel> port, float& min, float& max) const;
void port_value_range(SharedPtr<PortModel> port, float& min, float& max) const;
+ std::string port_label(SharedPtr<PortModel> port) const;
+
// Signals
sigc::signal<void, SharedPtr<PortModel> > signal_new_port;
sigc::signal<void, SharedPtr<PortModel> > signal_removed_port;