tweaks to all steps
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "speaker.h"
|
||||
|
||||
static i2s_chan_handle_t tx_chan;
|
||||
i2s_chan_handle_t tx_chan;
|
||||
|
||||
static const char *TAG = "speaker_driver";
|
||||
|
||||
@@ -18,7 +18,11 @@ esp_err_t play_raw(const char *fp) {
|
||||
size_t bytes_read = 0;
|
||||
size_t bytes_written = 0;
|
||||
|
||||
ESP_ERROR_CHECK(i2s_channel_enable(tx_chan));
|
||||
esp_err_t channel_enable_result = i2s_channel_enable(tx_chan);
|
||||
ESP_ERROR_CHECK_WITHOUT_ABORT(channel_enable_result);
|
||||
if (channel_enable_result != ESP_OK) {
|
||||
return channel_enable_result;
|
||||
}
|
||||
|
||||
bytes_read = fread(read_buf, sizeof(uint8_t), AUDIO_BUFFER, fh);
|
||||
for (int i = 0; i < bytes_read; i++) {
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#define SAMPLE_RATE 44100
|
||||
#define AUDIO_BUFFER 2048
|
||||
|
||||
extern i2s_chan_handle_t tx_chan;
|
||||
|
||||
esp_err_t play_raw(const char *fp);
|
||||
void init_speaker(void);
|
||||
void play_example();
|
||||
|
||||
Reference in New Issue
Block a user