A key requirement when dealing with AUDIO is the short and periodic handling of a chunk of audio data
a typical time loop has a value of 20ms and every time a chunk of audio data is read, then, task waiting for the data can be waken up and act upon it.
I can have this behaviour using a "waiter task" on i2s receive, reading using something like
Code: Select all
int retcode = i2s_channel_read(esp_audio.rx_handleP, &i2s_chunk, sizeof(i2s_chunk), &bytes_read, 100);there is a callback mechanism available, but as far as I know/understand it is not possible to set it up so when a chunk of data is available the callback happens.
Code: Select all
static bool i2s_rx_queue_overflow_callback(i2s_chan_handle_t handle, i2s_event_data_t *event, void *user_ctx)
{
wicounters.i2s_rx_queue_overflow_count++;
return false;
}
bool i2s_rx_queue_callback(i2s_chan_handle_t handle, i2s_event_data_t *event, void *user_ctx)
{
wicounters.i2s_rx_queue_cb_count++;
return false;
}
static const i2s_event_callbacks_t i2s_callback_cfg = {
.on_recv = i2s_rx_queue_callback,
.on_recv_q_ovf = i2s_rx_queue_overflow_callback,
.on_sent = NULL,
.on_send_q_ovf = NULL,
};
am I mistaken ?