Fix FloatModel::getDigitCount() returning wrong value#8394
Conversation
|
I can only test on Linux - not sure if this is sufficient for you. In any cases, this seems undesired:
(btw, it's weird that the Slider uses the English locale with a point, and the "Set value" uses - in my case - the German locale with a comma) |
|
Thanks for testing, I was able to reproduce the issue you mentioned, but I don't think it's caused by this PR since it happens on the latest nightly as well. It looks like the cause of the issue is that the GLAME Butterworth Lowpass filter's Cutoff Frequency model has a step size of 0.00248007, when it should probably be a power of 10. |
|
Agreeing that it's not caused by this PR, though I was wondering how difficult it would be to add a fix for it? |
|
I don't think it would be too difficult to fix, but it's probably better for that fix to be in a separate PR, since it involves a different part of the codebase (mainly |
|
Would you try that other PR? Otherwise I could try it, too, though I guess I'm slower 😄 |
|
Sure, I opened #8429 to fix that issue. |
|
Another example while testing:
Was this intended? |
|
I don't think there's an easy fix for that issue, since volume knobs show their value in dBFS but store it internally as a percentage. For example, if you double-click on a volume knob and set it to -63 dBFS, the value will actually get rounded to -60 dBFS, since internally the value gets rounded to 0.1%. Fixing the issue properly would probably require a deeper refactor of volume/model handling. |
|
Some more findings (tested with both of your PRs merged together):
Can you comment on those, please? |
|
I believe the things you mentioned happen because the set value dialog shows all of the decimal places in the value, while the knob tooltip just shows the value normally. I don't think it's a bad thing though, since it allows users to see the step size of a parameter as soon as they double click it, even if the current value is a whole number. |
|
OK, I will do some more investigations next week, and I am positive we can soon bring both of your PRs to master. |
Might be caused this bit in // make sure, we're using common ways to print/scan
// floats to/from strings (',' vs. '.' for decimal point etc.)
setlocale(LC_NUMERIC, "C"); |
Fixes #8393 by refactoring
FloatModel::getDigitCount()to use a logarithm instead of a while loop to calculate the number of digits from the model's step size. This prevents any issues from floating-point imprecision.