File tree Expand file tree Collapse file tree 1 file changed +15
-12
lines changed
adafruit_circuitplayground Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -673,18 +673,21 @@ def play_file(self, file_name):
673
673
"""
674
674
# Play a specified file.
675
675
self ._speaker_enable .value = True
676
- if sys .implementation .version [0 ] >= 3 :
677
- audio = audioio .AudioOut (board .SPEAKER )
678
- file = audioio .WaveFile (open (file_name , "rb" ))
679
- audio .play (file )
680
- while audio .playing :
681
- pass
682
- audio .deinit ()
683
- else :
684
- audio = audioio .AudioOut (board .SPEAKER , open (file_name , "rb" ))
685
- audio .play ()
686
- while audio .playing :
687
- pass
676
+ try :
677
+ if sys .implementation .version [0 ] >= 3 :
678
+ audio = audioio .AudioOut (board .SPEAKER )
679
+ file = audioio .WaveFile (open (file_name , "rb" ))
680
+ audio .play (file )
681
+ while audio .playing :
682
+ pass
683
+ audio .deinit ()
684
+ else :
685
+ audio = audioio .AudioOut (board .SPEAKER , open (file_name , "rb" ))
686
+ audio .play ()
687
+ while audio .playing :
688
+ pass
689
+ except RuntimeError :
690
+ pass
688
691
self ._speaker_enable .value = False
689
692
690
693
You can’t perform that action at this time.
0 commit comments