Parameter Display: rounded / truncated for precision

I want to add a Parameter Display view and let it show the control tag value but truncated or rounded to a specific number of decimal points. I was thinking value-precision would set just that but it doesn’t seem to have any effect. What’s the proper way to do that?

The value-precision is overwritten when you use the VST3Editor class. In that case you need to make sure that the Parameter in your VST3 plug-in does this truncation for its string representation.

Which class should I use instead of the VST3Editor class for this to work?

You need to change your parameter class, not the UI. Make sure that the string display of your parameter the generic editor is as you want.

1 Like

@clwe found it:

	parameter->toString (valueNormalized, string);

yes, for those having the same question – you need to override the getParamStringByValue() method in your VST3Editor-derived controller class, e.g. like so:

tresult PLUGIN_API getParamStringByValue (ParamID tag, ParamValue valueNormalized, String128 string) SMTG_OVERRIDE {
    if (Parameter* parameter = getParameterObject (tag))
        parameter->setPrecision(0); //  <-- set precision here
		parameter->toString (valueNormalized, string);
		return kResultTrue;
	return kResultFalse;


Actually you do this at the time when you create the Parameter, not when you change the value of it. That’s at least more efficient.

1 Like

The precision is commonly set in
Controller::initialize(FUnknown* context)
Parameter* param = new RangeParameter(USTRING(Attack), kAttack, USTRING( %), 0, 1, 0);
param->setPrecision(4); // fractional sig digits|
// …
However there is another precision setting in ui-description i.e.:
which makes nary any discernible change in the displayed digits.

Yes, this threw us off too, a bit confusing that is.

Yes. I would like my internal calculations to be high precision and the displayed values adjustable in the ui-description file.

1 Like