8#define M_PI (3.14159265358979323846f)
282 LOGE(
"GoertzelStream: channel %d out of range (max %d)", config.
channel,
382 if (
p_print ==
nullptr)
return len;
491 if (magnitude > 0.0f)
497 if (reference ==
nullptr) reference =
ref;
517 template <
typename T =
int16_t>
520 const T* samples =
reinterpret_cast<const T*
>(data);
521 size_t num_samples = data_len /
sizeof(T);
523 for (
size_t i = 0; i < num_samples; i++) {
526 float normalized =
clip(NumberConverter::toFloatT<T>(samples[i]) *
528 LOGD(
"sample: %f", normalized);
531 if (detector.processSample(normalized)) {
551 if (value > 1.0f)
return 1.0f;
552 if (value < -1.0f)
return -1.0f;
580 processSamplesOfType<uint8_t>(data, data_len, channels);
583 processSamplesOfType<int16_t>(data, data_len, channels);
586 processSamplesOfType<int24_t>(data, data_len, channels);
589 processSamplesOfType<int32_t>(data, data_len, channels);
#define LOGD(...)
Definition AudioLoggerIDF.h:27
#define LOGE(...)
Definition AudioLoggerIDF.h:30
#define M_PI
Definition MDFEchoCancellationConfig.h:66
virtual size_t write(const uint8_t *data, size_t len)
Definition Arduino.h:120
virtual size_t readBytes(uint8_t *data, size_t len)
Definition Arduino.h:140