fixed rounding and test warning
This commit is contained in:
parent
4f40bce8d3
commit
c688a0e209
@ -328,7 +328,7 @@ JNI_FUNC(nativeSetParameter)(JNIEnv* env, jobject thiz, jint i, jfloat v) {
|
||||
if (param_data[i].flags & (PARAM_BYPASS | PARAM_TOGGLED))
|
||||
v = v > 0.5f ? 1.f : 0.f;
|
||||
else if (param_data[i].flags & PARAM_INTEGER)
|
||||
v = (int32_t)(v + 0.5f);
|
||||
v = (int32_t)(v + (v >= 0.? : 0.5f : -0.5f));
|
||||
v = std::min(std::max(v, param_data[i].min), param_data[i].max);
|
||||
#if PARAMETERS_N > 0
|
||||
mutex.lock();
|
||||
|
@ -293,7 +293,7 @@ int main(int argc, char * argv[]) {
|
||||
if (param_data[i].flags & (PARAM_BYPASS | PARAM_TOGGLED))
|
||||
v = v > 0.5f ? 1.f : 0.f;
|
||||
else if (param_data[i].flags & PARAM_INTEGER)
|
||||
v = (int32_t)(v + 0.5f);
|
||||
v = (int32_t)(v + (v >= 0.f ? 0.5f : -0.5f));
|
||||
|
||||
param_values[i] = clampf(v, param_data[i].min, param_data[i].max);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ static float parameterUnmap(int i, float v) {
|
||||
|
||||
static float parameterAdjust(int i, float v) {
|
||||
v = param_data[i].flags & (PARAM_BYPASS | PARAM_TOGGLED) ? (v >= 0.5f ? 1.f : 0.f)
|
||||
: (param_data[i].flags & PARAM_INTEGER ? (int32_t)(v + 0.5f) : v);
|
||||
: (param_data[i].flags & PARAM_INTEGER ? (int32_t)(v + (v >= 0.f ? 0.5f : -0.5f)) : v);
|
||||
return clampf(v, param_data[i].min, param_data[i].max);
|
||||
}
|
||||
|
||||
|
@ -343,7 +343,7 @@ void setParameter(int i, float v) {
|
||||
if (param_data[i].flags & (PARAM_BYPASS | PARAM_TOGGLED))
|
||||
v = v > 0.5f ? 1.f : 0.f;
|
||||
else if (param_data[i].flags & PARAM_INTEGER)
|
||||
v = (int32_t)(v + 0.5f);
|
||||
v = (int32_t)(v + (v >= 0.f ? 0.5f : -0.5f));
|
||||
v = std::min(std::max(v, param_data[i].min), param_data[i].max);
|
||||
#if PARAMETERS_N > 0
|
||||
mutex.lock();
|
||||
|
@ -190,7 +190,7 @@ static void run(LV2_Handle instance, uint32_t sample_count) {
|
||||
else if (param_data[j].flags & DATA_PARAM_TOGGLED)
|
||||
v = *i->c[k] > 0.f ? 1.f : 0.f;
|
||||
else if (param_data[j].flags & DATA_PARAM_INTEGER)
|
||||
v = (int32_t)(*i->c[k] + 0.5f);
|
||||
v = (int32_t)(*i->c[k] + (*i->c[k] >= 0.f ? 0.5f : -0.5f));
|
||||
else
|
||||
v = *i->c[k];
|
||||
|
||||
|
@ -44,7 +44,7 @@ static double parameterUnmap(Steinberg_Vst_ParamID id, double v) {
|
||||
|
||||
static double parameterAdjust(Steinberg_Vst_ParamID id, double v) {
|
||||
v = parameterData[id].flags & (DATA_PARAM_BYPASS | DATA_PARAM_TOGGLED) ? (v >= 0.5 ? 1.0 : 0.0)
|
||||
: (parameterData[id].flags & DATA_PARAM_INTEGER ? (int32_t)(v + 0.5) : v);
|
||||
: (parameterData[id].flags & DATA_PARAM_INTEGER ? (int32_t)(v + (v >= 0.0 ? 0.5 : -0.5)) : v);
|
||||
return clamp(v, parameterData[id].min, parameterData[id].max);
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ static void plugin_process(plugin *instance, const float **inputs, float **outpu
|
||||
|
||||
static void plugin_midi_msg_in(plugin *instance, size_t index, const uint8_t * data) {
|
||||
(void)index;
|
||||
if ((data[0] & 0xf0 == 0x90) && (data[2] != 0))
|
||||
if (((data[0] & 0xf0) == 0x90) && (data[2] != 0))
|
||||
//approx instance->cutoff_k = powf(2.f, (1.f / 12.f) * (note - 60));
|
||||
instance->cutoff_k = data[1] < 64 ? (-0.19558034980097166f * data[1] - 2.361735109225749f) / (data[1] - 75.57552349522389f) : (393.95397927344214f - 7.660826245588588f * data[1]) / (data[1] - 139.0755234952239f);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user