5#ifndef MAX_ZERO_READ_COUNT
6#define MAX_ZERO_READ_COUNT 3
9#ifndef CHANNEL_SELECT_BUFFER_SIZE
10#define CHANNEL_SELECT_BUFFER_SIZE 256
36 if (transform ==
nullptr) {
37 LOGE(
"transform is NULL");
41 LOGE(
"p_stream is NULL");
47 LOGD(
"TransformationReader::readBytes: %d", (
int)len);
53 LOGE(
"p_stream is NULL");
65 LOGD(
"TransformationReader::readBytes: %d -> %d", (
int)len,
result_len);
78 LOGD(
"TransformationReader::available: %d", available_bytes);
132 if (byte_factor <= 0.0f) {
133 LOGE(
"Invalid byte factor: %f", byte_factor);
147 LOGD(
"setupBuffers: %d", (
int)len);
151 int size = (0.5f / byte_factor * len);
154 if (size <= 0) size = 4;
156 LOGI(
"read size: %d", size);
175 LOGD(
"fillResultQueue: %d", (
int)len);
181 LOGE(
"fillResultQueue: result_queue_buffer too small: %d < %d. "
182 "Increase result_queue_factor or call resizeReadResultQueue().",
193 LOGE(
"fillResultQueue: result_queue full (%d) but target not reached "
194 "(%d/%d). Increase result_queue_factor or call "
195 "resizeReadResultQueue().",
201 LOGD(
"readBytes from source: %d -> %d", read_size,
read_eff);
287 LOGD(
"ReformatBaseStream::readBytes: %d", (
int)len);
288 return reader.readBytes(data, len);
292 return reader.available();
494 for (
int j = 0;
j <
vector.size();
j++) {
500 for (
int j = 0;
j <
vector.size();
j++) {
506 for (
auto& out :
vector) {
514 int written = out->write(copy + start, open);
523 for (
int j = 0;
j <
vector.size();
j++) {
535 if (
tmp !=
nullptr &&
tmp->isDeletable()) {
738 int toread = min(1024, open);
748 if (bytes_per_second > 0) {
752 LOGE(
"AudioInfo not defined");
779 for (
auto&
ch : out.channels) {
797 def.p_audio_info = &out;
809 def.p_audio_info = &out;
845 def.p_audio_info = &out;
858 def.p_audio_info = &out;
864 LOGD(
"write %d", (
int)len);
884 result.
channels = info.channels.size();
899 template <
typename T>
902 int sample_count = size /
sizeof(
T);
904 T* data = (
T*)buffer;
906 for (
int i = 0; i < sample_count; i +=
cfg.
channels) {
911 for (
auto&
ch : out.channels) {
920 if (out.buffer.availableForWrite() <
sizeof(
out_frame)) {
921 out.p_out->write(out.buffer.data(), out.buffer.available());
#define CHANNEL_SELECT_BUFFER_SIZE
Definition AudioIO.h:10
#define MAX_ZERO_READ_COUNT
Definition AudioIO.h:6
#define TRACED()
Definition AudioLoggerIDF.h:31
#define LOGI(...)
Definition AudioLoggerIDF.h:28
#define LOGD(...)
Definition AudioLoggerIDF.h:27
#define LOGE(...)
Definition AudioLoggerIDF.h:30
#define DEFAULT_BUFFER_SIZE
Definition avr.h:20
virtual int availableForWrite()
Definition Arduino.h:128
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
virtual int available()
Definition Arduino.h:139