File tree 1 file changed +13
-7
lines changed
adafruit_circuitplayground 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change 1
1
# The MIT License (MIT)
2
2
#
3
3
# Copyright (c) 2016 Scott Shawcroft for Adafruit Industries
4
- # Copyright (c) 2017 Kattni Rembor for Adafruit Industries
4
+ # Copyright (c) 2017-2018 Kattni Rembor for Adafruit Industries
5
5
#
6
6
# Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
# of this software and associated documentation files (the "Software"), to deal
21
21
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
22
# THE SOFTWARE.
23
23
24
- # We have a lot of attributes for this complex sensor .
24
+ # We have a lot of attributes for this complex library .
25
25
# pylint: disable=too-many-instance-attributes
26
26
27
27
"""
@@ -689,11 +689,17 @@ def play_file(self, file_name):
689
689
"""
690
690
# Play a specified file.
691
691
self ._speaker_enable .value = True
692
- audio = audioio .AudioOut (board .SPEAKER , open (file_name , "rb" ))
693
-
694
- audio .play ()
695
- while audio .playing :
696
- pass
692
+ if sys .implementation .version [0 ] >= 3 :
693
+ audio = audioio .AudioOut (board .SPEAKER )
694
+ file = audioio .WaveFile (open (file_name , "rb" ))
695
+ audio .play (file )
696
+ while audio .playing :
697
+ pass
698
+ else :
699
+ audio = audioio .AudioOut (board .SPEAKER , open (file_name , "rb" ))
700
+ audio .play ()
701
+ while audio .playing :
702
+ pass
697
703
self ._speaker_enable .value = False
698
704
699
705
You can’t perform that action at this time.
0 commit comments