Bug1636: fix Crash on OK selecting RIAA or Telephone Eq curve...
... Really two crashes, one in case Linear frequency scale is selected, the
other if Logarithmic.
Problem was introduced at commit 7d5e54e364
This commit is contained in:
parent
54af4f1ff7
commit
4a500c77dd
|
@ -1680,12 +1680,20 @@ void EffectEqualization::setCurve(int currentCurve)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
// There are more points at higher freqs,
|
||||||
|
// so interpolate next one then stop.
|
||||||
when = 1.0;
|
when = 1.0;
|
||||||
double lastF = mCurves[currentCurve].points[pointCount-1].Freq;
|
|
||||||
double nextF = mCurves[currentCurve].points[pointCount].Freq;
|
|
||||||
double lastDB = mCurves[currentCurve].points[pointCount-1].dB;
|
|
||||||
double nextDB = mCurves[currentCurve].points[pointCount].dB;
|
double nextDB = mCurves[currentCurve].points[pointCount].dB;
|
||||||
value = lastDB + ((nextDB - lastDB) * ((mHiFreq - lastF) / (nextF - lastF)));
|
if (pointCount > 0) {
|
||||||
|
double nextF = mCurves[currentCurve].points[pointCount].Freq;
|
||||||
|
double lastF = mCurves[currentCurve].points[pointCount-1].Freq;
|
||||||
|
double lastDB = mCurves[currentCurve].points[pointCount-1].dB;
|
||||||
|
value = lastDB +
|
||||||
|
((nextDB - lastDB) *
|
||||||
|
((mHiFreq - lastF) / (nextF - lastF)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
value = nextDB;
|
||||||
env->InsertOrReplace(when, value);
|
env->InsertOrReplace(when, value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1751,9 +1759,14 @@ void EffectEqualization::setCurve(int currentCurve)
|
||||||
|
|
||||||
// interpolate the final point instead
|
// interpolate the final point instead
|
||||||
when = 1.0;
|
when = 1.0;
|
||||||
double logLastF = log10(mCurves[currentCurve].points[pointCount-1].Freq);
|
if (pointCount > 0) {
|
||||||
double lastDB = mCurves[currentCurve].points[pointCount-1].dB;
|
double lastDB = mCurves[currentCurve].points[pointCount-1].dB;
|
||||||
value = lastDB + ((value - lastDB) * ((log10(mHiFreq) - logLastF) / (flog - logLastF)));
|
double logLastF =
|
||||||
|
log10(mCurves[currentCurve].points[pointCount-1].Freq);
|
||||||
|
value = lastDB +
|
||||||
|
((value - lastDB) *
|
||||||
|
((log10(mHiFreq) - logLastF) / (flog - logLastF)));
|
||||||
|
}
|
||||||
env->InsertOrReplace(when, value);
|
env->InsertOrReplace(when, value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue