MCPcopy Create free account
hub / github.com/audacity/audacity / EnvLinToLog

Method EnvLinToLog

src/effects/EqualizationBandSliders.cpp:153–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153void EqualizationBandSliders::EnvLinToLog(void)
154{
155 auto &parameters = mCurvesList.mParameters;
156 auto &linEnvelope = parameters.mLinEnvelope;
157 auto &logEnvelope = parameters.mLogEnvelope;
158 const auto &hiFreq = parameters.mHiFreq;
159
160 size_t numPoints = linEnvelope.GetNumberOfPoints();
161 if( numPoints == 0 )
162 {
163 return;
164 }
165
166 Doubles when{ numPoints };
167 Doubles value{ numPoints };
168
169 logEnvelope.Flatten(0.);
170 logEnvelope.SetTrackLen(1.0);
171 linEnvelope.GetPoints( when.get(), value.get(), numPoints );
172 logEnvelope.Reassign(0., value[0]);
173 double loLog = log10(20.);
174 double hiLog = log10(hiFreq );
175 double denom = hiLog - loLog;
176 bool changed = false;
177
178 for (size_t i = 0; i < numPoints; i++)
179 {
180 if( when[i]*hiFreq >= 20 )
181 {
182 // Caution: on Linux, when when == 20, the log calculation rounds
183 // to just under zero, which causes an assert error.
184 double flog = (log10(when[i]*hiFreq )-loLog)/denom;
185 logEnvelope.Insert(std::max(0.0, flog) , value[i]);
186 }
187 else
188 { //get the first point as close as we can to the last point requested
189 changed = true;
190 double v = value[i];
191 logEnvelope.Insert(0., v);
192 }
193 }
194 logEnvelope.Reassign(1., value[numPoints - 1]);
195
196 if(changed)
197 mCurvesList.EnvelopeUpdated(logEnvelope, false);
198}
199
200void EqualizationBandSliders::ErrMin(void)
201{

Callers 2

UpdateGraphicMethod · 0.80
OnLinFreqMethod · 0.80

Calls 9

maxFunction · 0.85
GetNumberOfPointsMethod · 0.80
SetTrackLenMethod · 0.80
GetPointsMethod · 0.80
ReassignMethod · 0.80
EnvelopeUpdatedMethod · 0.80
FlattenMethod · 0.45
getMethod · 0.45
InsertMethod · 0.45

Tested by

no test coverage detected