2
0
Fork 0
OPL/Source/IntFloatParameter.cpp
George Reales 03b6d2c2ef v1.8
Parameter exposure (AU/iOS AUv3/VST/VST3) for host automation.
iOS Universal build with iPhone support.
Enhanced AUv3 GUI window display fit.
AUv3 GUI scrolling using left and right border sides.
2020-09-14 11:02:19 +02:00

37 lines
673 B
C++
Executable file

#include "IntFloatParameter.h"
IntFloatParameter::IntFloatParameter(String name, int min, int max)
:FloatParameter(name)
{
this->min = min;
this->max = max;
}
IntFloatParameter::~IntFloatParameter(void)
{
}
int IntFloatParameter::getParameterValue(void)
{
int range = max - min;
int i = (int)(this->value * range) + min;
if (i > range)
i = range;
return i;
}
void IntFloatParameter::setParameterValue(int i)
{
this->value = (float)(i - min)/(float)(max - min);
if (this->value < 0.0f)
this->value = 0.0f;
else if (this->value > 1.0f)
this->value = 1.0f;
}
String IntFloatParameter::getParameterText(void)
{
return String(this->getParameterValue());
}