13
0

Use VST's print_parameter() when applicable.

This commit is contained in:
Robin Gareus 2019-03-11 02:56:08 +01:00
parent 484e0d0fb2
commit bdcfab73f8
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 20 additions and 1 deletions

View File

@ -208,6 +208,7 @@ public:
double get_value (void) const;
void catch_up_with_external_value (double val);
XMLNode& get_state();
std::string get_user_string() const;
private:
PluginInsert* _plugin;

View File

@ -3001,6 +3001,20 @@ PluginInsert::PluginControl::get_value () const
return plugin->get_parameter (_list->parameter().id());
}
std::string
PluginInsert::PluginControl::get_user_string () const
{
boost::shared_ptr<Plugin> plugin = _plugin->plugin (0);
if (plugin) {
char buf[32];
if (plugin->print_parameter (parameter().id(), buf, sizeof(buf))) {
assert (strlen (buf) > 0);
return std::string (buf) + " (" + AutomationControl::get_user_string () + ")";
}
}
return AutomationControl::get_user_string ();
}
PluginInsert::PluginPropertyControl::PluginPropertyControl (PluginInsert* p,
const Evoral::Parameter& param,
const ParameterDescriptor& desc,

View File

@ -807,9 +807,11 @@ VSTPlugin::has_editor () const
}
bool
VSTPlugin::print_parameter (uint32_t param, char *buf, uint32_t /*len*/) const
VSTPlugin::print_parameter (uint32_t param, char *buf, uint32_t len) const
{
char *first_nonws;
assert (len > VestigeMaxShortLabelLen);
memset (buf, 0, len);
_plugin->dispatcher (_plugin, 7 /* effGetParamDisplay */, param, 0, buf, 0);
@ -817,6 +819,8 @@ VSTPlugin::print_parameter (uint32_t param, char *buf, uint32_t /*len*/) const
return false;
}
buf[len - 1] = '\0';
first_nonws = buf;
while (*first_nonws && isspace (*first_nonws)) {
first_nonws++;