6#if defined(USE_ESP32_DSP)
13#define PRINT_FLUSH_OVERRIDE override
15#define PRINT_FLUSH_OVERRIDE
29 virtual size_t write(
const uint8_t *data,
size_t len)
override = 0;
68 for (
int j = 0;
j < len / 2;
j++) {
115template <
typename T =
int16_t>
124 bool active =
true) {
176 LOGD(
"CsvOutput::write: %d", (
int)len);
178 LOGE(
"is not active");
187 LOGW(
"Channels not defined: using 2");
193 }
else if (len ==
sizeof(
T)) {
205 LOGE(
"Unsupported size: %d for channels %d and bits: %d", (
int)len,
232 this->out_ptr->println();
251 bool active =
true) {
271 for (
size_t j = 0;
j < len;
j++) {
368template <
typename T =
int16_t>
403 for (
int i = 0; i < count; i++) {
407 for (
int i = 0; i < count; i++) {
417 if (channel <
size()) {
420 LOGE(
"Invalid channel %d - max is %d", channel,
size() - 1);
464 LOGD(
"write idx %d: %d", idx, (
int)bytes);
467 assert(p_buffer !=
nullptr);
468 size_t samples = bytes /
sizeof(
T);
473 "Available Buffer %d too small %d: requested: %d -> increase the "
489 if (p_buffer ==
nullptr)
return 0;
496 if (p_buffer ==
nullptr)
return 0;
518 LOGD(
"write to final out: %d",
static_cast<int>(samples *
sizeof(
T)));
551 if (bytes == 0)
return 0;
559 if (bytes == 0)
return 0;
607#if defined(USE_ESP32_DSP)
609 float mix_out[samples] = {0.0f};
610 float temp[samples] = {0.0f};
615 for (
uint16_t i = 0; i < samples; i++) {
618 temp[i] =
static_cast<float>(
s) * factor;
625 for (
size_t i = 0; i < samples; i++) {
635 for (
int i = 0; i < samples; i++) {
638 output[i] +=
static_cast<T>(factor * sample);
691 LOGE(
"start must not be null");
703 if (
p_next ==
nullptr)
return 0;
769 template <
typename T =
int16_t>
771 int sample_count = size /
sizeof(
T);
773 T *data = (
T *)buffer;
774 T result[result_size];
781 result[i++] = data[
j];
786 if (written != result_size *
sizeof(
T)) {
787 LOGW(
"Could not write all samples");
static HardwareSerial Serial
Definition Arduino.h:179
@ HEX
Definition Arduino.h:54
#define LOGW(...)
Definition AudioLoggerIDF.h:29
#define TRACEI()
Definition AudioLoggerIDF.h:32
#define TRACED()
Definition AudioLoggerIDF.h:31
#define LOGD(...)
Definition AudioLoggerIDF.h:27
#define LOGE(...)
Definition AudioLoggerIDF.h:30
#define PRINT_FLUSH_OVERRIDE
Definition AudioOutput.h:15
#define DEFAULT_BUFFER_SIZE
Definition avr.h:20
#define assert(T)
Definition avr.h:10
virtual size_t write(const uint8_t *data, size_t len)
Definition Arduino.h:120
virtual void flush()
Definition Arduino.h:130
RxTxMode
The Microcontroller is the Audio Source (TX_MODE) or Audio Sink (RX_MODE). RXTX_MODE is Source and Si...
Definition AudioTypes.h:26
@ TX_MODE
Definition AudioTypes.h:26