Skip to content

Commit 2dcd909

Browse files
committed
codal_port/modaudio: Make audio waiting wait for audio to be silent.
Signed-off-by: Damien George <[email protected]>
1 parent d0080bc commit 2dcd909

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/codal_port/modaudio.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ void microbit_audio_play_source(mp_obj_t src, mp_obj_t pin_select, bool wait, ui
301301

302302
if (wait) {
303303
// Wait the audio to exhaust the iterator.
304-
while (audio_is_running()) {
304+
while (microbit_audio_is_playing()) {
305305
mp_handle_pending(true);
306306
microbit_hal_idle();
307307
}
@@ -333,7 +333,9 @@ static mp_obj_t play(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ar
333333
MP_DEFINE_CONST_FUN_OBJ_KW(microbit_audio_play_obj, 0, play);
334334

335335
bool microbit_audio_is_playing(void) {
336-
return audio_is_running() || microbit_hal_audio_is_expression_active();
336+
return audio_is_running()
337+
|| microbit_hal_audio_is_playing()
338+
|| microbit_hal_audio_is_expression_active();
337339
}
338340

339341
mp_obj_t is_playing(void) {

0 commit comments

Comments
 (0)