LabSound begin
| 276 | |
| 277 | // LabSound begin |
| 278 | void 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 | |
| 302 | void RealtimeAnalyser::getByteTimeDomainData(std::vector<uint8_t> & destinationArray) |