logue-sdk icon indicating copy to clipboard operation
logue-sdk copied to clipboard

[NTS-1 mkII / NTS-3] The behavior of the frac parameter in header.c is incorrect

Open boochow opened this issue 5 months ago • 2 comments

Describe the bug

The number shown on display differs from what the API documents say. Therefore, the behavior is also different from that of the drumlogue.

When fracmode = 0, the display shows incorrect numbers when frac is greater than 3. When fracmode = 1, the display shows "(parameter value) / (10 ^ frac)," which is inconsistent with the API description.

for example: frac=4 and fracmode = 0:

valule 0 1 2 3 4 5
display 0 0.125 0.125 0.250 0.250 0.375
should be 0 0.0625 0.125 0.1875 0.250 0.3125

frac=3 and fracmode = 1:

valule 0 1 2 3 4 5
display 0 0.001 0.002 0.003 0.004 0.005
should be 0 0.033 0.067 0.100 0.133 0.166

To Reproduce I tested the following parameter description in header.c on NTS-3.

      {0, 5, 0, 0, k_unit_param_type_none, 1, 0, 0, {"PARAM1"}},
      {0, 5, 0, 0, k_unit_param_type_none, 2, 0, 0, {"PARAM2"}},
      {0, 5, 0, 0, k_unit_param_type_none, 3, 0, 0, {"PARAM3"}},
      {0, 5, 0, 0, k_unit_param_type_none, 4, 0, 0, {"PARAM4"}},
      {0, 5, 0, 0, k_unit_param_type_none, 1, 1, 0, {"PARAM5"}},
      {0, 5, 0, 0, k_unit_param_type_none, 2, 1, 0, {"PARAM6"}},
      {0, 5, 0, 0, k_unit_param_type_none, 3, 1, 0, {"PARAM7"}},
      {0, 5, 0, 0, k_unit_param_type_none, 4, 1, 0, {"PARAM8"}}

Expected behavior

The API document says that the fracmode parameter is:

When set to 0, values will be assumed to be fixed point with the lower frac bits representing the fractional part. When set to 1, values will be assumed to include a fractional part that is multiplied by 10 times frac number of decimals, allowing for base 10 fractional increment/decrements.

In the case of fracmode = 0: Show value/ (2^frac) on display. (the integer value for setParameter() is displayed_number * (2^frac)).

In the case of fracmode = 1: Show value/ (10 * frac) on display. (the integer value for setParameter() is displayed_number * 10 * frac).

boochow avatar Sep 06 '24 13:09 boochow