Skip to content

Commit ae3014d

Browse files
committed
2 parents 8b038c5 + a20ca7a commit ae3014d

File tree

5 files changed

+25
-16
lines changed

5 files changed

+25
-16
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ if (DEFINED ESP_PLATFORM)
44

55
# idf component
66
idf_component_register(
7-
SRC_DIRS src
7+
# SRC_DIRS src
88
INCLUDE_DIRS src
99
REQUIRES bt esp_common freertos hal log nvs_flash driver
1010
)
1111

12-
target_compile_options(${COMPONENT_LIB} PUBLIC -DESP32_CMAKE=1 -Wno-error -Wno-format -fpermissive)
12+
target_compile_options(${COMPONENT_LIB} INTERFACE -DESP32_CMAKE=1 -Wno-error -Wno-format -fpermissive)
1313

1414
else()
1515

src/AudioAnalog/AnalogDriverESP32V1.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ class AnalogDriverESP32V1 : public AnalogDriverBase {
276276
// LOGI("adc_continuous_read request:%d samples %d bytes requested", samples_requested, (uint32_t)(samples_requested * sizeof(adc_digi_output_data_t)));
277277
if (adc_continuous_read(self->adc_handle, (uint8_t *)result_data, (uint32_t)(samples_requested * sizeof(adc_digi_output_data_t)), &bytes_read, (uint32_t)self->cfg.timeout) == ESP_OK) {
278278
samples_read = bytes_read / sizeof(adc_digi_output_data_t);
279-
LOGD("adc_continuous_read -> %u bytes / %d samples of %d bytes requested", (unsigned)bytes_read, samples_read, (uint32_t)(samples_requested * sizeof(adc_digi_output_data_t)));
279+
LOGD("adc_continuous_read -> %u bytes / %d samples of %d bytes requested", (unsigned)bytes_read, samples_read, (int)(samples_requested * sizeof(adc_digi_output_data_t)));
280280

281281
// Parse and store data in FIFO buffers
282282
for (int i = 0; i < samples_read; i++) {
@@ -297,10 +297,10 @@ class AnalogDriverESP32V1 : public AnalogDriverBase {
297297
if (self->fifo_buffers[idx]->push(data)) {
298298
LOGD("Sample %d, FIFO %d, ch %u, d %u", i, idx, chan_num, data);
299299
} else {
300-
LOGE("Sample %d, FIFO buffer is full, ch %u, d %u", i, idx, chan_num, data);
300+
LOGE("Sample %d, FIFO buffer is full, ch %u, d %u", i, (unsigned)chan_num, data);
301301
}
302302
} else {
303-
LOGE("Sample %d, ch %u not found in configuration, d: %u", i, chan_num, data);
303+
LOGE("Sample %d, ch %u not found in configuration, d: %u", i, (unsigned)chan_num, data);
304304
for (int k = 0; k < self->cfg.channels; ++k) {
305305
LOGE("Available config ch: %u", self->cfg.adc_channels[k]);
306306
}
@@ -349,7 +349,7 @@ class AnalogDriverESP32V1 : public AnalogDriverBase {
349349
if (self->fifo_buffers[idx]->push(data)) {
350350
LOGD("Top Off Sample %d, FIFO %d, ch %u, d %u", i, idx, chan_num, data);
351351
} else {
352-
LOGE("Top Off Sample %d, FIFO buffer is full, ch %u, d %u", i, idx, chan_num, data);
352+
LOGE("Top Off Sample %d, FIFO buffer is full, ch %u, d %u", i, chan_num, data);
353353
}
354354
} else {
355355
LOGE("Top Off Sample %d, ch %u not found in configuration, d %u", i, chan_num, data);
@@ -517,12 +517,13 @@ class AnalogDriverESP32V1 : public AnalogDriverBase {
517517
} else {
518518
LOGI("buffer_size: %u samples, conv_frame_size: %u bytes", cfg.buffer_size, (unsigned)conv_frame_size);
519519
}
520-
520+
521521
// Create adc_continuous handle
522-
adc_continuous_handle_cfg_t adc_config = {
523-
.max_store_buf_size = (uint32_t)conv_frame_size * 2,
524-
.conv_frame_size = (uint32_t) conv_frame_size,
525-
};
522+
adc_continuous_handle_cfg_t adc_config;
523+
adc_config.max_store_buf_size = (uint32_t)conv_frame_size * 2;
524+
adc_config.conv_frame_size = (uint32_t) conv_frame_size;
525+
adc_config.flags.flush_pool = true;
526+
526527
err = adc_continuous_new_handle(&adc_config, &adc_handle);
527528
if (err != ESP_OK) {
528529
LOGE("adc_continuous_new_handle failed with error: %d", err);

src/AudioI2S/I2SESP32V1.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,12 @@ class I2SDriverESP32V1 {
159159
result = I2S_STD_MSB_SLOT_DEFAULT_CONFIG(
160160
(i2s_data_bit_width_t)cfg.bits_per_sample,
161161
(i2s_slot_mode_t)cfg.channels);
162+
break;
162163
case I2S_PCM:
163164
result = I2S_STD_PCM_SLOT_DEFAULT_CONFIG(
164165
(i2s_data_bit_width_t)cfg.bits_per_sample,
165166
(i2s_slot_mode_t)cfg.channels);
167+
break;
166168
default:
167169
result = I2S_STD_PHILIPS_SLOT_DEFAULT_CONFIG(
168170
(i2s_data_bit_width_t)cfg.bits_per_sample,
@@ -178,8 +180,8 @@ class I2SDriverESP32V1 {
178180
case I2SChannelSelect::Right:
179181
result.slot_mask = I2S_STD_SLOT_RIGHT;
180182
break;
181-
case I2SChannelSelect::Stereo:
182-
LOGW("Invalid channel_format: %d", cfg.channel_format);
183+
default:
184+
LOGW("Invalid channel_format: %d", (int)cfg.channel_format);
183185
break;
184186
}
185187
}

src/AudioTools/AudioStreams.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1649,7 +1649,7 @@ class VolumeMeter : public ModifyingStream {
16491649
if (p_out!=nullptr){
16501650
result = p_out->write(data, len);
16511651
}
1652-
return len;
1652+
return result;
16531653
}
16541654

16551655
size_t readBytes(uint8_t *data, size_t len){

src/AudioTools/BaseConverter.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,10 @@ class ChannelDiffT : public BaseConverter {
859859
T *p_source = (T *)src;
860860

861861
for (int i = 0; i < sample_count; i++) {
862-
*p_result++ = *p_source++ - *p_source++;
862+
// *p_result++ = *p_source++ - *p_source++;
863+
auto tmp = *p_source++;
864+
tmp -= *p_source++;
865+
*p_result++ = tmp;
863866
}
864867

865868
return sizeof(T) * sample_count;
@@ -936,7 +939,10 @@ class ChannelAvgT : public BaseConverter {
936939
T *p_source = (T *)src;
937940

938941
for (int i = 0; i < sample_count; i++) {
939-
*p_result++ = (*p_source++ + *p_source++) / 2; // Average the pair of channels
942+
// *p_result++ = (*p_source++ + *p_source++) / 2; // Average the pair of channels
943+
auto tmp = *p_source++;
944+
tmp += *p_source++;
945+
*p_result++ = tmp / 2;
940946
}
941947

942948
LOGD("channel average %d samples, %d bytes", sample_count, size);

0 commit comments

Comments
 (0)