Skip to content

Commit 4aed81a

Browse files
committed
fix audio calls to be compatible with CP5.0 audiocore
1 parent 2c74c4a commit 4aed81a

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Minesweep/code.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
import digitalio
1919
import displayio
2020
import audioio
21+
try:
22+
from audiocore import WaveFile
23+
except ImportError:
24+
from audioio import WaveFile
25+
2126
import adafruit_imageload
2227
import adafruit_touchscreen
2328

@@ -216,7 +221,7 @@ def reset_board():
216221
def play_sound(file_name):
217222
board.DISPLAY.wait_for_frame()
218223
wavfile = open(file_name, "rb")
219-
wavedata = audioio.WaveFile(wavfile)
224+
wavedata = WaveFile(wavfile)
220225
speaker_enable.value = True
221226
audio.play(wavedata)
222227
return wavfile

0 commit comments

Comments
 (0)