COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 05-06-2020, 11:06 AM   #1
SaschArt
Human being with feelings
 
SaschArt's Avatar
 
Join Date: Aug 2013
Posts: 236
Default Safe huge values on controls

What are the maximum values I can use for the parameters as InitInt()

I tried values at 16000 k InitInt("", 4882812, 0, 16000000); but it is not saved correctly in the host. After reopening the project, wrong values in control are restored.

How can I find out the maximum value I can use safely ?
__________________
Audio plugins | BrainWaveProducer | EmRysRa
SaschArt is offline   Reply With Quote
Old 05-07-2020, 12:03 AM   #2
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
Default

By default IPlug stores all parameter values as doubles, so it should be able to store all possible 32-bit int values.
Tale is offline   Reply With Quote
Old 05-07-2020, 04:40 AM   #3
SaschArt
Human being with feelings
 
SaschArt's Avatar
 
Join Date: Aug 2013
Posts: 236
Default

void VSTCALLBACK IPlugVST::VSTSetParameter(AEffect *pEffect, VstInt32 idx, float value)

Restore values as float, very limited
__________________
Audio plugins | BrainWaveProducer | EmRysRa
SaschArt is offline   Reply With Quote
Old 05-07-2020, 08:42 AM   #4
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
Default

For parameters that are automated you mean? Yeah, that's a bit more complicated though, because these are normalized to values in the [0.0, 1.0] range, and then cast from double to float and back. Still, the float type has a precision of 2^24, which should be just about enough for all ints in the [0, 16000000] range (because 16000000 < 2^24).

Note that this limitation (from the VST2 API) is not just for int parameters, but for any parameter type, including double. Also, 2^24 is the max precision because of the float type, but the host might use less precision internally for whatever reason.

BTW, it might be better (IMHO, YMMV) to use double for a parameter with such a wide range, and maybe also factor out 1k, e.g.:

Code:
InitDouble("", 4882.812, 0.0, 16000.0, 0.001, "k");
Tale is offline   Reply With Quote
Old 05-08-2020, 04:17 AM   #5
SaschArt
Human being with feelings
 
SaschArt's Avatar
 
Join Date: Aug 2013
Posts: 236
Default

Quote:
BTW, it might be better (IMHO, YMMV) to use double for a parameter with such a wide range, and maybe also factor out 1k, e.g.:

Code:
InitDouble("", 4882.812, 0.0, 16000.0, 0.001, "k");
This is good ideea ! Thanks
__________________
Audio plugins | BrainWaveProducer | EmRysRa

Last edited by SaschArt; 05-08-2020 at 04:33 AM.
SaschArt 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 02:24 PM.


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