13
0

Display unit-label of VST parameters -- #7938

This commit is contained in:
Robin Gareus 2020-03-26 02:16:33 +01:00
parent 8fe3c367cf
commit eeb2e99a3b
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 17 additions and 6 deletions

View File

@ -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 ();

View File

@ -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;
}