COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :

Go Back   Cockos Incorporated Forums > Other Software Discussion > WDL users forum

Reply
 
Thread Tools Display Modes
Old 10-30-2017, 09:54 AM   #1
Nowhk
Human being with feelings
 
Join Date: Mar 2016
Posts: 234
Default Is the "stepping" logic correct within WDL-OL?

Hi all,

are we sure that using:

Code:
mValue = floor(0.5 + mValue / mStep) * mStep;
for stepping values is a good deal between Control and Param?

Example.
Let say I tweak my IKnob from the GUI, which will change the linked Param's mValue (which is a double, where I've set a step of 0.1).
Let say that the (normalized) tweaked value correspond (once converted in "real" mValue within SetNormalized) exactly to a rounding edge point; 0.05 in our example, which can be exactly expressed in floating point notation.

The calculated (and stepped) mValue become (with the stepping formula used by IPlug) 0.10000000000000001; so the stepped value we will use for audio is 0.1 (well, not exactly 0.1, but we will consider it 0.1, approximation is not important here).

The problem is that the label that the IKnob will show (using default WDL_string, which operate with the vsnprintf family):

Code:
mTextValue.SetFormatted(MAX_PARAM_DISPLAY_LEN, %.1f, 0.05, pParam->GetLabelForHost());
will be 0.0, because it use a different "round" method (which will depends by the compiler and os).

So basically, you work with audio around 0.1, but the knob will display 0.0.

Heres the code with the test I did: http://coliru.stacked-crooked.com/a/b9084e6001eb85e7

I know there are very few values/situations for these scenario... but... it could happens! Do you just ignore it?
If I'm unlucky, and I set the knob to the value above for a Pitch param, it will play +1 semitones even if the knob show +0 semitones...

Last edited by Nowhk; 10-30-2017 at 10:00 AM.
Nowhk is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:26 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.