Skip to content

Fix audiocore.RawSample with loop=False on esp32* #10540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ports/espressif/common-hal/audiobusio/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ static void i2s_fill_buffer(i2s_t *self) {
while (!self->stopping && output_buffer_size > 0) {
if (self->sample_data == self->sample_end) {
uint32_t sample_buffer_length;
uint8_t *old_sample_data = self->sample_data;
audioio_get_buffer_result_t get_buffer_result =
audiosample_get_buffer(self->sample, false, 0,
&self->sample_data, &sample_buffer_length);
self->sample_end = self->sample_data + sample_buffer_length;
if (get_buffer_result == GET_BUFFER_DONE) {
if (self->loop) {
audiosample_reset_buffer(self->sample, false, 0);
} else {
} else if (old_sample_data) {
self->stopping = true;
break;
}
Expand Down
Loading