2
0
Fork 0
OPL/Source/EnumFloatParameter.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

35 lines
672 B
C++
Executable file

#include "EnumFloatParameter.h"
EnumFloatParameter::EnumFloatParameter(String name, StringArray values)
:FloatParameter(name)
{
this->values = values;
}
EnumFloatParameter::~EnumFloatParameter(void)
{
}
int EnumFloatParameter::getParameterIndex(void)
{
int i = (int)(this->value * values.size() + 0.5f);
if (i >= values.size())
i = values.size() - 1;
return i;
}
void EnumFloatParameter::setParameterIndex(int i)
{
this->value = (float)i/(float)values.size();
if (this->value < 0.0f)
this->value = 0.0f;
else if (this->value > 1.0f)
this->value = 1.0f;
}
String EnumFloatParameter::getParameterText(void)
{
return values[this->getParameterIndex()];
}