def __init__(self, volume=1.0, channel_id=0):
self.volume = int(volume*100)
self.channel_id = 0
+ self.paused = False
if channel_id == -1:
self.channel_id = channel_id
self.channel = None # flag to show this uses pygame.mixer.music
else:
pygame.mixer.music.load(sound)
pygame.mixer.music.play(loops)
+ def pause(self):
+ if self.paused:
+ self.paused = False
+ if self.channel == None:
+ pygame.mixer.music.unpause()
+ else:
+ self.channel.unpause()
+ else:
+ self.paused = True
+ if self.channel == None:
+ pygame.mixer.music.pause()
+ else:
+ self.channel.pause()
def playlist(self, path):
self.music_path = path
self.playlist = [ f for f in os.listdir(self.music_path) if os.path.isfile(os.path.join(self.music_path, f)) ]
k = event.key
if k == pygame.K_p:
time.sleep(10)
+ elif k == pygame.K_7:
+ myGame.soundtrack.pause()
+ elif k == pygame.K_l:
+ auto_scroll = True if auto_scroll == False else False
+
if event.type == pygame.USEREVENT:
if DEBUG: print("pygame.USEREVENT received; calling playlist_next()")
myGame.soundtrack.playlist_next()
if keys_pressed[pygame.K_6]:
# volume down
myGame.soundtrack.down()
- elif keys_pressed[pygame.K_7]:
+ elif keys_pressed[pygame.K_8]:
# volume up
myGame.soundtrack.up()
elif keys_pressed[pygame.K_d]:
movement = stepping
elif keys_pressed[pygame.K_a]:
movement = -stepping
- elif keys_pressed[pygame.K_l]:
- auto_scroll = True if auto_scroll == False else False
myGame.soundtrack.fadeout(5000)
time.sleep(5)