@@ -226,7 +226,7 @@ void common_hal_audiomp3_mp3file_construct(audiomp3_mp3file_obj_t *self,
226226}
227227
228228void common_hal_audiomp3_mp3file_set_file (audiomp3_mp3file_obj_t * self , pyb_file_obj_t * file ) {
229- background_callback_begin_critical_section ();
229+ background_callback_prevent ();
230230
231231 self -> file = file ;
232232 f_lseek (& self -> file -> fp , 0 );
@@ -244,7 +244,7 @@ void common_hal_audiomp3_mp3file_set_file(audiomp3_mp3file_obj_t *self, pyb_file
244244 memset (self -> buffers [1 ], 0 , MAX_BUFFER_LEN );
245245 MP3FrameInfo fi ;
246246 bool result = mp3file_get_next_frame_info (self , & fi );
247- background_callback_end_critical_section ();
247+ background_callback_allow ();
248248 if (!result ) {
249249 mp_raise_msg (& mp_type_RuntimeError ,
250250 MP_ERROR_TEXT ("Failed to parse MP3 file" ));
@@ -296,7 +296,7 @@ void audiomp3_mp3file_reset_buffer(audiomp3_mp3file_obj_t *self,
296296 }
297297 // We don't reset the buffer index in case we're looping and we have an odd number of buffer
298298 // loads
299- background_callback_begin_critical_section ();
299+ background_callback_prevent ();
300300 f_lseek (& self -> file -> fp , 0 );
301301 self -> inbuf_offset = self -> inbuf_length ;
302302 self -> eof = 0 ;
@@ -305,7 +305,7 @@ void audiomp3_mp3file_reset_buffer(audiomp3_mp3file_obj_t *self,
305305 mp3file_update_inbuf_half (self );
306306 mp3file_skip_id3v2 (self );
307307 mp3file_find_sync_word (self );
308- background_callback_end_critical_section ();
308+ background_callback_allow ();
309309}
310310
311311audioio_get_buffer_result_t audiomp3_mp3file_get_buffer (audiomp3_mp3file_obj_t * self ,
0 commit comments