- if not music.is_playing():
- music.play(volume = volume, fade_in = fade_in, start_at = start_at)
- else:
- pygame.mixer.unpause()
-
- def stop(self, music = None, fade_out = 0, **kwargs):
- if music is not None:
- music.stop(fade_out = fade_out)
- else:
- if fade_out > 0:
- pygame.fadeout(fade_out * 1000)
- else:
- pygame.mixer.stop()
-
- def stop_all_actions(self, **kwargs):
- self.key.mapping.stop_all_running()
-
- def volume(self, music = None, value = 100, **kwargs):
- if music is not None:
- music.set_volume(value)
- else:
- pass
-
- def wait(self, duration = 0, **kwargs):
- # FIXME: Make it stoppable
- # http://stackoverflow.com/questions/29082268/python-time-sleep-vs-event-wait
- time.sleep(duration)
-
- def command_print(self, command = "", **kwargs):
- return "running command {}".format(command)
-
- def pause_print(self, music = None, **kwargs):
- if music is not None:
- return "pausing {}".format(music.filename)