From 64ef9b6ae602c86216e05674b5bd0f3d6bada1e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergiusz=20=27q3k=27=20Baza=C5=84ski?= Date: Sun, 14 Jul 2013 17:48:31 +0200 Subject: [PATCH] Added logging. --- host.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/host.py b/host.py index 5372340..4273bd5 100644 --- a/host.py +++ b/host.py @@ -23,14 +23,16 @@ MAPPING = [ 0 ] -SPATH = "/mnt/nas/Projects/soundboard/sounds/" +SPATH = "sounds/" class SimpleSound: def __init__(self, path): self.path = path def create(self): + print("Loading {}".format(self.path)) self.s = pygame.mixer.Sound(SPATH + self.path) def play(self): + print("Playing {}".format(self.path)) self.s.play() return self.s.get_length() * 0.5 @@ -38,9 +40,11 @@ class RandomSound: def __init__(self, paths): self.paths = paths def create(self): - self.sounds = [pygame.mixer.Sound(SPATH + p) for p in self.paths] + print("Loading {}".format(", ".join(self.paths))) + self.sounds = [(pygame.mixer.Sound(SPATH + p), p) for p in self.paths] def play(self): - s = random.choice(self.sounds) + s, path = random.choice(self.sounds) + print("Playing {}".format(path)) print(s) s.play() return s.get_length() * 0.5 @@ -70,7 +74,7 @@ if __name__ == "__main__": pygame.joystick.init() j = pygame.joystick.Joystick(0) j.init() - + print("Ready!") while True: pygame.event.pump()