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

Method getFloatTimeDomainData

src/core/RealtimeAnalyser.cpp:278–299  ·  view source on GitHub ↗

LabSound begin

Source from the content-addressed store, hash-verified

276
277// LabSound begin
278void RealtimeAnalyser::getFloatTimeDomainData(std::vector<float> & destinationArray)
279{
280 if (!destinationArray.size())
281 return;
282
283 size_t fftSize = this->fftSize();
284 size_t len = min(fftSize, destinationArray.size());
285 if (len > 0)
286 {
287 bool isInputBufferGood = m_inputBuffer.size() == InputBufferSize && m_inputBuffer.size() > fftSize;
288 ASSERT(isInputBufferGood);
289 if (!isInputBufferGood)
290 return;
291
292 float * inputBuffer = m_inputBuffer.data();
293 size_t writeIndex = m_writeIndex;
294
295 for (size_t i = 0; i < len; ++i)
296 // Buffer access is protected due to modulo operation.
297 destinationArray[i] = inputBuffer[(i + writeIndex - fftSize + InputBufferSize) % InputBufferSize];
298 }
299}
300// LabSound end
301
302void RealtimeAnalyser::getByteTimeDomainData(std::vector<uint8_t> & destinationArray)

Callers

nothing calls this directly

Calls 3

fftSizeMethod · 0.95
sizeMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected