Skip to content

Commit

Permalink
codal_port/modaudio: Round up AudioFrame size to nearest 32.
Browse files Browse the repository at this point in the history
Signed-off-by: Damien George <[email protected]>
  • Loading branch information
dpgeorge committed Jan 18, 2024
1 parent ad11e7a commit c70611c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/codal_port/modaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ STATIC mp_obj_t microbit_audio_frame_new(const mp_obj_type_t *type_in, size_t n_
mp_raise_ValueError(MP_ERROR_TEXT("size out of bounds"));
} else {
size = args[ARG_duration].u_int * rate / 1000;
// Round up the size to the nearest AUDIO_CHUNK_SIZE.
size = (size + AUDIO_CHUNK_SIZE - 1) & ~(AUDIO_CHUNK_SIZE - 1);
}

return microbit_audio_frame_make_new(size, rate);
Expand Down

0 comments on commit c70611c

Please sign in to comment.