mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-18 09:00:52 +02:00
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 7d5e54e364fcccd630274f2658703543d8c596eb
This commit is contained in:
parent
54af4f1ff7
commit
4a500c77dd
@ -1680,12 +1680,20 @@ void EffectEqualization::setCurve(int currentCurve)
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// There are more points at higher freqs,
|
||||
// so interpolate next one then stop.
|
||||
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;
|
||||
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);
|
||||
break;
|
||||
}
|
||||
@ -1751,9 +1759,14 @@ void EffectEqualization::setCurve(int currentCurve)
|
||||
|
||||
// interpolate the final point instead
|
||||
when = 1.0;
|
||||
double logLastF = log10(mCurves[currentCurve].points[pointCount-1].Freq);
|
||||
double lastDB = mCurves[currentCurve].points[pointCount-1].dB;
|
||||
value = lastDB + ((value - lastDB) * ((log10(mHiFreq) - logLastF) / (flog - logLastF)));
|
||||
if (pointCount > 0) {
|
||||
double lastDB = mCurves[currentCurve].points[pointCount-1].dB;
|
||||
double logLastF =
|
||||
log10(mCurves[currentCurve].points[pointCount-1].Freq);
|
||||
value = lastDB +
|
||||
((value - lastDB) *
|
||||
((log10(mHiFreq) - logLastF) / (flog - logLastF)));
|
||||
}
|
||||
env->InsertOrReplace(when, value);
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user