| 267 | } |
| 268 | |
| 269 | SoundCaptureResult* SoundCapture::hasResult(AnimationBaseMusic* effect, uint32_t& lastIndex, bool* newAverage, bool* newSlow, bool* newFast, int* isMulti) |
| 270 | { |
| 271 | QMutexLocker locker(&soundBufferGuard); |
| 272 | |
| 273 | if (lastIndex != resultFFT.getResultIndex()) |
| 274 | { |
| 275 | lastIndex = resultFFT.getResultIndex(); |
| 276 | |
| 277 | effect->store(&resultFFT.mtInternal); |
| 278 | |
| 279 | *isMulti = 2; |
| 280 | |
| 281 | if (newAverage != nullptr) |
| 282 | *newAverage = true; |
| 283 | if (newSlow != nullptr) |
| 284 | *newSlow = true; |
| 285 | if (newFast != nullptr) |
| 286 | *newFast = true; |
| 287 | |
| 288 | return &resultFFT; |
| 289 | } |
| 290 | |
| 291 | effect->restore(&resultFFT.mtWorking); |
| 292 | |
| 293 | if (*isMulti <= 0 || !_enable_smoothing) |
| 294 | { |
| 295 | return nullptr; |
| 296 | } |
| 297 | |
| 298 | (*isMulti)--; |
| 299 | |
| 300 | if (newAverage != nullptr) |
| 301 | *newAverage = resultFFT.hasMiddleAverage(*isMulti); |
| 302 | |
| 303 | if (newSlow != nullptr) |
| 304 | *newSlow = resultFFT.hasMiddleSlow(*isMulti); |
| 305 | |
| 306 | if (newFast != nullptr) |
| 307 | *newFast = resultFFT.hasMiddleFast(*isMulti); |
| 308 | |
| 309 | effect->store(&resultFFT.mtWorking); |
| 310 | |
| 311 | return &resultFFT; |
| 312 | } |
| 313 | |
| 314 | /* Code below based on work: |
| 315 | Tom Roberts 11/8/89 |
no test coverage detected