File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ def playwave(filename):
30
30
audiopwr_on ()
31
31
i2s = audiobusio .I2SOut (AUDIO_BCK ,AUDIO_WS ,AUDIO_DATA )
32
32
try :
33
- wave_file = open ('audio/cn_girl/{}' . format ( filename ) , "rb" )
33
+ wave_file = open (filename , "rb" )
34
34
wave = audiocore .WaveFile (wave_file )
35
35
i2s .play (wave )
36
36
while i2s .playing :
@@ -46,6 +46,7 @@ def playwave(filename):
46
46
audiopwr_off ()
47
47
pass
48
48
49
+
49
50
class Dice :
50
51
def __init__ (self ):
51
52
self .value = 0
@@ -93,12 +94,13 @@ def stop(self):
93
94
94
95
95
96
96
- TICK_DICE = 3 .0
97
+ TICK_DICE = 1 .0
97
98
#
98
99
async def draw (dice ):
99
100
starttick = 0.0
100
101
while True :
101
102
if dice .f_start == True :
103
+ playwave ("audio/dice/dice.wav" )
102
104
starttick = time .monotonic ()
103
105
dice .f_start = False
104
106
dice .f_loop = True
@@ -109,7 +111,7 @@ async def draw(dice):
109
111
tile_grid .x = display .width // 2 - 50 + random .randint (- 10 ,10 )
110
112
tile_grid .y = display .height // 2 - 50 + random .randint (- 10 ,10 )
111
113
if time .monotonic ()- starttick >= TICK_DICE :
112
- playwave ("{}.wav" .format (voice [dice .value ]))
114
+ playwave ("audio/cn_girl/ {}.wav" .format (voice [dice .value ]))
113
115
dice .f_loop = False
114
116
dice .f_stop = True
115
117
You can’t perform that action at this time.
0 commit comments