Helper to check if samples are within valid range [-1.0, 1.0] with some tolerance
| 10 | |
| 11 | // Helper to check if samples are within valid range [-1.0, 1.0] with some tolerance |
| 12 | static bool samplesInRange(const float* samples, int32_t count, float tolerance = 1.5f) { |
| 13 | for (int32_t i = 0; i < count; ++i) { |
| 14 | if (samples[i] < -tolerance || samples[i] > tolerance) { |
| 15 | return false; |
| 16 | } |
| 17 | } |
| 18 | return true; |
| 19 | } |
| 20 | |
| 21 | // Helper to check if waveform has significant variation (not all zeros or constant) |
| 22 | static bool hasVariation(const float* samples, int32_t count) { |