Bug: Rounding error in juce_VST3_Wrapper.cpp results in wrong preset names communicated with host

In juce_VST3_Wrapper.cpp, the following line has problems with rounding errors:

475:    toString128 (result, owner.getProgramName (static_cast<int> (value * info.stepCount)));

For certain values (e.g. info.stepCount == 31 and value = 0.1290322542…) this would result in incorrect values due to rounding errors (in this example: 3.9999 which is incorrectly truncated to 3 instead of being properly rounded to 4). This results in the wrong preset name appearing in a VST3 host.

A simple round() fixes this.

1 Like

Just to be a little clearer: The problem appears when the plugin changes its current preset and calls updateHostDisplay(). This results int he host displaying the wrong preset name due to the rounding error.

This is fixed in the latest version of JUCE.

1 Like