Parameters values conversion


Hello everybody.
Is there any easy way to convert parameters values between non 0 - 1 vst parameters into 0 - 1 parameters?
For instance, I need to have a slider in a plugin which goes from - 30 to 43, and I want it to be saved and loaded by the host in the proper way.


Would be good to have a parameter system embed in JUCE that convert that stuff (an deal with automation etc…) automatically .

Here’s some hints,

float convertToHost (float val, float min, float max)
			float range = (max) - (min);
			val= (val - min)/range;
			return val;

[/code][code]float convertFromHost (float val,float min,float max)
		{	float range = (max) - (min);
			return (val*range) + min;

Either you use those function as float function, either you copy the formulas were you need conversion (inside i.e. sliderValueChanged & updateParameterFromFilter)

Hope this helps some,



Thank you!
That’s what I needed: a scaling function like Max/Msp’s scale object!