1111def periodic ():
1212 for i in range (0 , num_channels ):
1313 if i in channels :
14- channels [i ].periodic ()
14+ channels [i ].periodic ()
1515
1616num_channels = 8
1717reserved_channels = 0
@@ -78,11 +78,11 @@ def find_channel(force=False):
7878
7979 if not force :
8080 return None
81-
81+
8282 busy .sort (key = lambda x : x .play_time )
8383
8484 return busy [0 ]
85-
85+
8686class ChannelImpl (object ):
8787
8888 def __init__ (self , id ):
@@ -91,28 +91,28 @@ def __init__(self, id):
9191 self .queued = None
9292
9393 self .play_time = time .time ()
94-
94+
9595 def periodic (self ):
9696 qd = sound .queue_depth (self .id )
9797
9898 if qd < 2 :
9999 self .queued = None
100-
100+
101101 if self .loop is not None and sound .queue_depth (self .id ) < 2 :
102102 self .queue (self .loop , loops = 1 )
103103
104-
104+
105105 def play (self , s , loops = 0 , maxtime = 0 , fade_ms = 0 ):
106106 if loops :
107107 self .loop = s
108108
109109 sound .play (self .id , s .file , s .serial )
110110
111111 self .play_time = time .time ()
112-
112+
113113 with condition :
114114 condition .notify ()
115-
115+
116116
117117 def stop (self ):
118118 self .loop = None
@@ -158,7 +158,7 @@ def queue(self, s):
158158 def get_queue (self ):
159159 return self .queued
160160
161-
161+
162162def Channel (n ):
163163 """
164164 Gets the channel with the given number.
@@ -174,18 +174,18 @@ def Channel(n):
174174
175175sound_serial = 0
176176sounds = { }
177-
177+
178178class Sound (object ):
179-
179+
180180 def __init__ (self , what ):
181181
182182 # Doesn't support buffers.
183-
183+
184184 global sound_serial
185185
186186 self .serial = str (sound_serial )
187187 sound_serial += 1
188-
188+
189189 if isinstance (what , file ):
190190 self .file = what
191191 else :
@@ -231,7 +231,7 @@ class music(object):
231231 def load (filename ):
232232
233233 music_channel .stop ()
234-
234+
235235 global music_sound
236236 music_sound = Sound (filename )
237237
@@ -271,7 +271,7 @@ def get_volume():
271271
272272 @staticmethod
273273 def get_busy ():
274- return music_channel .get_volume ()
274+ return music_channel .get_busy ()
275275
276276 @staticmethod
277277 def get_pos ():
@@ -281,5 +281,5 @@ def get_pos():
281281 def queue (filename ):
282282 return music_channel .queue (Sound (filename ))
283283
284-
285-
284+
285+
0 commit comments