[Bug?] Parameter numeric excursion automatically rescaled to [0.0 - 1.0]

15 views
Skip to first unread message

Federico Berti

unread,
Feb 27, 2017, 6:29:13 PM2/27/17
to Symbiosis AU VST
Hello everyone,

today I've experienced an issue with one of my plug-ins regarding how parameter values are displayed on a GUI-less Audio Unit.

Basically I have a parameter with an excursion that goes from 0.01 to 50.00 but it's being displayed as 0.0 to 1.0 when I load the plug-in in an AU host.

Looking and debugging the Symbiosis wrapper (latest version), I've found the culprit.
At line 2562 there is an IF statement which resets the parameter to the default scale (0.0 to 1.0) when one of the checks evaluates to true.
In my case, the issue is in this check:

(avgValue = (lowValue + highValue) * 0.5f, midValue < avgValue - 0.0001f || midValue > avgValue + 0.0001f)

The problem relies on the fact that avgValue (same as lowValuehighValue, etc.) is a float value parsed from the string returned by a call to the VST method getParameterDisplay().

In my framework, I can set how many fractional digits are being returned by getParameterDisplay() and I set it to 2, in this case.

What happens here is this:
lowValue is parsed from the string "0.01", which is fine.
highValue is parsed from the string "50.00", which is fine as well.
midValue is parsed from the string resulting from the conversion of the float value 25.005 to a string of 2 fractional digits, which turns to be "25.01" because of the rounding!

So I have: 
midValue = 25.01;
avgValue = 25.005;

and this causes the above check to evaluate to true (because midValue > avgValue + 0.0001f) and reset the parameter range to 0.0 - 1.0.

My question is: is that check really needed? If so, why?

A developer may need to restrict the fractional digits returned by the getParameterDisplay(), for example to make the displayed value more friendly to the user (avoiding stupid values like 25.0049999999992), but that check may cause the rounding to introduce the problem I've described above.
Can this be considered a bug?

Please discuss.

Thanks,
Federico Berti - Ignite Amps

Reply all
Reply to author
Forward
0 new messages