Does Cubase rounds value around 0.5 for channel pre gain or i do smthng wrong?

Please, help
I created script for x touch mini that scales cc messages to arbitrary values
midi->changes surface var->onProcessValue sets knob val->knod binded to selected channel pre gain

But i observe strange behaviour
For example then i try to control channel Pre Gain with custom variable in onProcessValue:

var value = knob[i].getProcessValue(context)+ oldValue * 127. / knobTicks[i]
knob[i].setProcessValue(context, value)

where knobTicks[i] = 48 * 2 * 10

i get change in pre gain in 0.1dB steps almost in all range of values as expected

But then value approach 0.5 (0dB pre gain) cubase rounds it off to 0.5
so no matter what scaling is used i get jump in observed GUI value from 0.8 dB to 0dB

What should i do to solve this problem?

Hi, this maybe happens due to rounding issues in the MR. You can find an interesting thread and a workaround I’ve come up with, here:

Though, I’m not really sure whether it works solid.

1 Like

Thank you so much for reply
I’ve seen before that conversation, but at that time didn’t understand what it was about

Now i tried your rounding trick and it doesn’t seem to do anything useful
rounding on 24th bit level is far beyond values that cubase rounds around 0.5
i could enter from gui pregain=0.1db and it corresponds to value=0.502… but cubase rounds value send from controllers starting from 0.508…

it looks like something in this post @mlib

it is something like a “catch range”, host will receive value and i could print it from host value, but if it lies in ~[0.49,0.508] it will round it to 0.5 afterwards

very annoying feature… though i can imagine why it was designed this way