MCPcopy Create free account
hub / github.com/LabSound/LabSound / getFloatFrequencyData

Method getFloatFrequencyData

src/core/RealtimeAnalyser.cpp:164–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162}
163
164void RealtimeAnalyser::getFloatFrequencyData(std::vector<float> & destinationArray)
165{
166 if (!destinationArray.size())
167 return;
168
169 doFFTAnalysis();
170
171 // Convert from linear magnitude to floating-point decibels.
172 const double minDecibels = m_minDecibels;
173 size_t sourceLength = magnitudeBuffer().size();
174 size_t len = min(sourceLength, destinationArray.size());
175 if (len > 0)
176 {
177 const float * source = magnitudeBuffer().data();
178 for (size_t i = 0; i < len; ++i)
179 {
180 float linearValue = source[i];
181 double dbMag = !linearValue ? minDecibels : AudioUtilities::linearToDecibels(linearValue);
182 destinationArray[i] = float(dbMag);
183 }
184 }
185}
186
187void RealtimeAnalyser::getByteFrequencyData(std::vector<uint8_t> & destinationArray, bool resample)
188{

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected