Skip to content

Fix FloatModel::getDigitCount() returning wrong value#8394

Open
extern-stat wants to merge 1 commit into
LMMS:masterfrom
extern-stat:digit-count-fix
Open

Fix FloatModel::getDigitCount() returning wrong value#8394
extern-stat wants to merge 1 commit into
LMMS:masterfrom
extern-stat:digit-count-fix

Conversation

@extern-stat

Copy link
Copy Markdown
Contributor

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.

@JohannesLorenz

Copy link
Copy Markdown
Contributor

I can only test on Linux - not sure if this is sufficient for you.

In any cases, this seems undesired:

  1. Use GLAME Butterworth Lowpass
  2. Drag "Cutoff Frequency" until "36.1198"
  3. Double click it - Set value shows "36,120"

(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)

@extern-stat

Copy link
Copy Markdown
Contributor Author

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.

@JohannesLorenz

Copy link
Copy Markdown
Contributor

Agreeing that it's not caused by this PR, though I was wondering how difficult it would be to add a fix for it?

@extern-stat

Copy link
Copy Markdown
Contributor Author

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 LadspaControl.cpp).

@JohannesLorenz

Copy link
Copy Markdown
Contributor

Would you try that other PR? Otherwise I could try it, too, though I guess I'm slower 😄

@extern-stat

Copy link
Copy Markdown
Contributor Author

Sure, I opened #8429 to fix that issue.

@rubiefawn rubiefawn added bug gui needs testing This pull request needs more testing labels Jun 12, 2026
@JohannesLorenz

Copy link
Copy Markdown
Contributor

Another example while testing:

  1. Start a new project with triple OSC
  2. The volume knob right to the TrackLabel "TripleOscillator": You can turn to "2.25 dBFS", but
  3. "Set value" says "2,3"

Was this intended?

@extern-stat

Copy link
Copy Markdown
Contributor Author

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.

@JohannesLorenz

JohannesLorenz commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Some more findings (tested with both of your PRs merged together):

  1. GLAME Butterworth Lowpass still shows an unnecessary "0" in the "Set value" dialog (just in the use case I showed above) (different to master)
  2. Triple OSC -> "Envelope, filter & LFO" Tab -> Volume -> Pre-Delay: Set to 0.2, "Set value" shows 0.200 (same issue on master)
  3. Still "Envelope, filter & LFO", bottom right "Q/RESO": 1.1 vs 1.10 (different to master)
  4. Automation Editor -> Tension (top right): 0.9 vs 0.90 (different to master)
  5. LFO Controller -> AMNT: 0.68 vs 0.680 (same issue on master)

Can you comment on those, please?

@extern-stat

Copy link
Copy Markdown
Contributor Author

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.

@JohannesLorenz

Copy link
Copy Markdown
Contributor

OK, I will do some more investigations next week, and I am positive we can soon bring both of your PRs to master.

@rubiefawn

Copy link
Copy Markdown
Contributor

(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)

Might be caused this bit in src/common/RemotePluginBase.cpp:

// make sure, we're using common ways to print/scan
// floats to/from strings (',' vs. '.' for decimal point etc.)
setlocale(LC_NUMERIC, "C");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug gui needs testing This pull request needs more testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set value dialog shows extra digit on models with small step size

3 participants