Skip to content

Commit c9026c0

Browse files
committed
Fix get_sample_byte, int8_t -> uint8_t
- required for properly constructing 16-bit values - changed printf to ESP_LOGW and ESP_LOGI
1 parent 1f2cf46 commit c9026c0

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

components/driver_sndmixer/snd_source_wav.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ int IRAM_ATTR wav_init_source(const void *data_start, const void *data_end, int
7373
chunk_hdr_t *ch = (chunk_hdr_t *)p;
7474
if (memcmp(ch->magic, "fmt ", 4) == 0) {
7575
if (ch->fmt.fmtcode != WAVE_FORMAT_PCM) {
76-
printf("Unsupported wav format: %d\n", ch->fmt.fmtcode);
76+
ESP_LOGW(TAG, "Unsupported wav format: %d\n", ch->fmt.fmtcode);
7777
goto err;
7878
}
7979
wav->rate = ch->fmt.samplespersec;
@@ -91,10 +91,10 @@ int IRAM_ATTR wav_init_source(const void *data_start, const void *data_end, int
9191
}
9292

9393
if (wav->bits != 8 && wav->bits != 16) {
94-
printf("No fmt chunk or unsupported bits/sample: %d\n", wav->bits);
94+
ESP_LOGW(TAG, "No fmt chunk or unsupported bits/sample: %d\n", wav->bits);
9595
goto err;
9696
}
97-
printf("Wav: %d bit/sample, %d Hz, %d bytes long\n", wav->bits, wav->rate, wav->data_len);
97+
ESP_LOGI(TAG, "channels: %d, bits: %d, rate: %d, len: %d", wav->channels, wav->bits, wav->rate, wav->data_len);
9898
wav->pos = 0;
9999
*ctx = (void *)wav;
100100
*stereo = (wav->channels >= 2);
@@ -183,8 +183,8 @@ int IRAM_ATTR wav_get_sample_rate(void *ctx) {
183183
return wav->rate;
184184
}
185185

186-
int8_t get_sample_byte(wav_ctx_t *wav) {
187-
int8_t rv = 0;
186+
uint8_t get_sample_byte(wav_ctx_t *wav) {
187+
uint8_t rv = 0;
188188
if(wav->stream) {
189189
int read = wav->stream_read(wav->stream, &rv, 1);
190190
wav->pos += read;

0 commit comments

Comments
 (0)