diff --git a/templates/vst3/src/.vst3.c.swp b/templates/vst3/src/.vst3.c.swp deleted file mode 100644 index fb49b37..0000000 Binary files a/templates/vst3/src/.vst3.c.swp and /dev/null differ diff --git a/templates/vst3/src/vst3.c b/templates/vst3/src/vst3.c index 22ba6f3..7f4d1f6 100644 --- a/templates/vst3/src/vst3.c +++ b/templates/vst3/src/vst3.c @@ -26,19 +26,14 @@ static double clamp(double x, double m, double M) { return x < m ? m : (x > M ? M : x); } -static double parameterMapLinear(Steinberg_Vst_ParamID id, double v) { - return parameterData[id].min + (parameterData[id].max - parameterData[id].min) * v; -} - static double parameterUnmapLinear(Steinberg_Vst_ParamID id, double v) { - return (v - parameterData[id].min) / (parameterData[id].max - parameterData[id].min); } static double parameterMap(Steinberg_Vst_ParamID id, double v) { - return parameterData[id].flags & DATA_PARAM_MAP_LOG ? parameterData[id].min * exp(parameterData[id].mapK * v) : parameterMapLinear(id, v); + return parameterData[id].flags & DATA_PARAM_MAP_LOG ? parameterData[id].min * exp(parameterData[id].mapK * v) : parameterData[id].min + (parameterData[id].max - parameterData[id].min) * v; } static double parameterUnmap(Steinberg_Vst_ParamID id, double v) { - return parameterData[id].flags & DATA_PARAM_MAP_LOG ? log(v / parameterData[id].min) / parameterData[id].mapK : parameterUnmapLinear(id, v); + return parameterData[id].flags & DATA_PARAM_MAP_LOG ? log(v / parameterData[id].min) / parameterData[id].mapK : (v - parameterData[id].min) / (parameterData[id].max - parameterData[id].min); } static double parameterAdjust(Steinberg_Vst_ParamID id, double v) { @@ -445,7 +440,7 @@ static Steinberg_tresult pluginProcess(void* thisInterface, struct Steinberg_Vst if (o != 0) continue; Steinberg_Vst_ParamID id = q->lpVtbl->getParameterId(q); - v = parameterAdjust(id, parameterMapLinear(id, v)); + v = parameterAdjust(id, parameterMap(id, v)); if (v != p->parameters[id]) { p->parameters[id] = v; plugin_set_parameter(&p->p, parameterData[id].index, p->parameters[id]); @@ -512,7 +507,7 @@ static Steinberg_tresult pluginProcess(void* thisInterface, struct Steinberg_Vst if (o <= 0) continue; Steinberg_Vst_ParamID id = q->lpVtbl->getParameterId(q); - v = parameterAdjust(id, parameterMapLinear(id, v)); + v = parameterAdjust(id, parameterMap(id, v)); if (v != p->parameters[id]) { p->parameters[id] = v; plugin_set_parameter(&p->p, parameterData[id].index, p->parameters[id]); @@ -797,13 +792,11 @@ static Steinberg_tresult controllerGetParamValueByString(void* thisInterface, St static Steinberg_Vst_ParamValue controllerNormalizedParamToPlain(void* thisInterface, Steinberg_Vst_ParamID id, Steinberg_Vst_ParamValue valueNormalized) { TRACE("controller normalized param to plain\n"); -printf("map %d %g -> %g\n", id, valueNormalized, parameterMap(id, valueNormalized)); return parameterMap(id, valueNormalized); } static Steinberg_Vst_ParamValue controllerPlainParamToNormalized(void* thisInterface, Steinberg_Vst_ParamID id, Steinberg_Vst_ParamValue plainValue) { TRACE("controller plain param to normalized\n"); -printf("unmap %d %g -> %g\n", id, plainValue, parameterUnmap(id, plainValue)); return parameterUnmap(id, plainValue); } diff --git a/test/product.json b/test/product.json index 1229458..e562204 100644 --- a/test/product.json +++ b/test/product.json @@ -33,20 +33,20 @@ "direction": "input", "isBypass": false, "isLatency": false, - "defaultValue": 10.0, - "minimum": 1.0, - "maximum": 100.0, + "defaultValue": 0.0, + "minimum": -60.0, + "maximum": 20.0, "toggled": false, "optional": false, "integer": false, "scalePoints": { - "0": 1.0, - "Max": 100.0, - "Min": 10.0 + "0": 0.0, + "Max": 20.0, + "Min": -60.0 }, "list": false, "unit": "db", - "map": "logarithmic" + "map": "linear" }, { "name": "Bypass",