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;
515 LOGD(
"write to final out: %d",
static_cast<int>(samples *
sizeof(
T)));
546 if (
bytes == 0)
return 0;
554 if (
bytes == 0)
return 0;
602#if defined(USE_ESP32_DSP)
604 float mix_out[samples] = {0.0f};
605 float temp[samples] = {0.0f};
610 for (
uint16_t i = 0; i < samples; i++) {
613 temp[i] =
static_cast<float>(
s) * factor;
620 for (
size_t i = 0; i < samples; i++) {
630 for (
int i = 0; i < samples; i++) {
633 output[i] +=
static_cast<T>(factor * sample);
682 LOGE(
"start must not be null");
694 if (
p_next ==
nullptr)
return 0;
760 template <
typename T =
int16_t>
762 int sample_count = size /
sizeof(
T);
764 T *data = (
T *)buffer;
765 T result[result_size];
772 result[i++] = data[
j];
777 if (written != result_size *
sizeof(
T)) {
778 LOGW(
"Could not write all samples");
#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 MIN(A, B)
Definition AudioTypes.h:17
@ HEX
Definition NoArduino.h:58
#define DEFAULT_BUFFER_SIZE
Definition avr.h:20
#define assert(T)
Definition avr.h:10
RxTxMode
The Microcontroller is the Audio Source (TX_MODE) or Audio Sink (RX_MODE). RXTX_MODE is Source and Si...
Definition AudioTypes.h:30
@ TX_MODE
Definition AudioTypes.h:30