log ok
This commit is contained in:
parent
4b45be6edf
commit
bb26bf3f6d
Binary file not shown.
@ -26,19 +26,14 @@ static double clamp(double x, double m, double M) {
|
|||||||
return x < m ? m : (x > M ? M : x);
|
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) {
|
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) {
|
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) {
|
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) {
|
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)
|
if (o != 0)
|
||||||
continue;
|
continue;
|
||||||
Steinberg_Vst_ParamID id = q->lpVtbl->getParameterId(q);
|
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]) {
|
if (v != p->parameters[id]) {
|
||||||
p->parameters[id] = v;
|
p->parameters[id] = v;
|
||||||
plugin_set_parameter(&p->p, parameterData[id].index, p->parameters[id]);
|
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)
|
if (o <= 0)
|
||||||
continue;
|
continue;
|
||||||
Steinberg_Vst_ParamID id = q->lpVtbl->getParameterId(q);
|
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]) {
|
if (v != p->parameters[id]) {
|
||||||
p->parameters[id] = v;
|
p->parameters[id] = v;
|
||||||
plugin_set_parameter(&p->p, parameterData[id].index, p->parameters[id]);
|
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) {
|
static Steinberg_Vst_ParamValue controllerNormalizedParamToPlain(void* thisInterface, Steinberg_Vst_ParamID id, Steinberg_Vst_ParamValue valueNormalized) {
|
||||||
TRACE("controller normalized param to plain\n");
|
TRACE("controller normalized param to plain\n");
|
||||||
printf("map %d %g -> %g\n", id, valueNormalized, parameterMap(id, valueNormalized));
|
|
||||||
return parameterMap(id, valueNormalized);
|
return parameterMap(id, valueNormalized);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Steinberg_Vst_ParamValue controllerPlainParamToNormalized(void* thisInterface, Steinberg_Vst_ParamID id, Steinberg_Vst_ParamValue plainValue) {
|
static Steinberg_Vst_ParamValue controllerPlainParamToNormalized(void* thisInterface, Steinberg_Vst_ParamID id, Steinberg_Vst_ParamValue plainValue) {
|
||||||
TRACE("controller plain param to normalized\n");
|
TRACE("controller plain param to normalized\n");
|
||||||
printf("unmap %d %g -> %g\n", id, plainValue, parameterUnmap(id, plainValue));
|
|
||||||
return parameterUnmap(id, plainValue);
|
return parameterUnmap(id, plainValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,20 +33,20 @@
|
|||||||
"direction": "input",
|
"direction": "input",
|
||||||
"isBypass": false,
|
"isBypass": false,
|
||||||
"isLatency": false,
|
"isLatency": false,
|
||||||
"defaultValue": 10.0,
|
"defaultValue": 0.0,
|
||||||
"minimum": 1.0,
|
"minimum": -60.0,
|
||||||
"maximum": 100.0,
|
"maximum": 20.0,
|
||||||
"toggled": false,
|
"toggled": false,
|
||||||
"optional": false,
|
"optional": false,
|
||||||
"integer": false,
|
"integer": false,
|
||||||
"scalePoints": {
|
"scalePoints": {
|
||||||
"0": 1.0,
|
"0": 0.0,
|
||||||
"Max": 100.0,
|
"Max": 20.0,
|
||||||
"Min": 10.0
|
"Min": -60.0
|
||||||
},
|
},
|
||||||
"list": false,
|
"list": false,
|
||||||
"unit": "db",
|
"unit": "db",
|
||||||
"map": "logarithmic"
|
"map": "linear"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Bypass",
|
"name": "Bypass",
|
||||||
|
Loading…
Reference in New Issue
Block a user