diff options
author | Robin Gareus <robin@gareus.org> | 2020-03-26 02:16:33 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-03-26 02:17:22 +0100 |
commit | eeb2e99a3b51e0327046f6e0a895694e101cd131 (patch) | |
tree | 145d773c41aa4ec08dffdbc2563b30987cceaa4a | |
parent | 8fe3c367cfc801cc6adb9ac681c3d36543eef3bb (diff) |
Display unit-label of VST parameters -- #7938
-rw-r--r-- | libs/ardour/plugin_insert.cc | 4 | ||||
-rw-r--r-- | libs/ardour/vst_plugin.cc | 19 |
2 files changed, 17 insertions, 6 deletions
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index 0f78777d13..7a98b874e0 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -3037,10 +3037,10 @@ PluginInsert::PluginControl::get_user_string () const { boost::shared_ptr<Plugin> plugin = _plugin->plugin (0); if (plugin) { - char buf[32]; + char buf[64]; if (plugin->print_parameter (parameter().id(), buf, sizeof(buf))) { assert (strlen (buf) > 0); - return std::string (buf) + " (" + AutomationControl::get_user_string () + ")"; + return std::string (buf); } } return AutomationControl::get_user_string (); diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc index ebce493d4c..8d8d46e090 100644 --- a/libs/ardour/vst_plugin.cc +++ b/libs/ardour/vst_plugin.cc @@ -406,13 +406,13 @@ VSTPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& desc) /* old style */ - char label[VestigeMaxLabelLen]; + char pname[VestigeMaxLabelLen]; /* some VST plugins expect this buffer to be zero-filled */ - memset (label, 0, sizeof (label)); + memset (pname, 0, sizeof (pname)); - _plugin->dispatcher (_plugin, effGetParamName, which, 0, label, 0); + _plugin->dispatcher (_plugin, effGetParamName, which, 0, pname, 0); - desc.label = Glib::locale_to_utf8 (label); + desc.label = Glib::locale_to_utf8 (pname); desc.lower = 0.0f; desc.upper = 1.0f; desc.smallstep = desc.step = 1.f / 300.f; @@ -834,6 +834,17 @@ VSTPlugin::print_parameter (uint32_t param, char *buf, uint32_t len) const } memmove (buf, first_nonws, strlen (buf) - (first_nonws - buf) + 1); + + /* optional Unit label */ + char label[VestigeMaxNameLen]; + memset (label, 0, sizeof (label)); + _plugin->dispatcher (_plugin, 6 /* effGetParamLabel */, param, 0, label, 0); + + if (strlen (label) > 0) { + std::string lbl = std::string (" ") + Glib::locale_to_utf8 (label); + strncat (buf, lbl.c_str(), strlen (buf) - 1); + } + return true; } |